-
Notifications
You must be signed in to change notification settings - Fork 0
Getting started
Every new language should introduce itself with a classic Hello, World!
print("Hello, World!")In jask you don't need to specify a main function or importing stuff. Invoke the jask interpreter and try it yourself!
The jask interpreter can be used in two ways: The interactive mode and the file mode.
The interactive mode allows you to enter jask code on the fly, just like the Python interactive mode.
To start the interactive mode, just invoke the jask interpreter:
dotnet runYou can exit the interactive mode with the keyword exit or the build-in function exit(code:number). For interpreting jask files, pass the file to the interpreter:
dotnet run example.jaskThe jask language has the attempt to be easy readable. So storing data goes like this:
store DATA in VARIABLEeasy, right? Currently, jask supports these types of data:
- strings, like "Hello!" or "This is a string"
- numbers, like 42 or 3.1415
- boolean values, can be true or false
- lists
- nil, to indicate an empty variable
Read more on lists here.
Jask allows you to apply basic operators on values. See the following example:
100 + 200
100 - 200
100 * 200
100 / 200
"Hello " + "World!"Functions are very straight forward in jask:
function doAwesomeStuff(param1: string, param2: number, param3: any)
if type(param3) == "list"
printLine(param1 + " " + param2 * listGet(param3, 2))
endif
end
; prints Hi! 300
doAwesomeStuff("Hi!", 100, list(1, 2, 3))You can read more on functions here.
A comment in a row can achieved by using a ;
; Prints the numbers of elapsed seconds since the 01.01.1970 unix time
print(clock())
; exits the program gracefully with status code 0
exit(0)