-
Notifications
You must be signed in to change notification settings - Fork 0
Basic Syntax
The let
statement can be used to define variable and put an initial value in them
let VARIABLE_NAME = VARIABLE_VALUE;
Example: let x = 0;
You can define multiple variables in one line using a comma as a separator
Example: let x = 0, y = 5;
A map can be accessed through the brackets '[]' operator
Example: let x[2] = 0;
Example: let x[0][2] = 3;
The print
statement can be used to print any variable or expression.
print EXPRESSION;
Example: print (x*5)^2;
You can print multiple expressions in one line using a comma as a separator
Example: print (x*5)^2, x*10;
The scan
statement can be used to scan a variable (even if it wasn't defined)
scan VARIABLE;
Example: scan x;
You can additionally specify the type to be scanned (default will decide between number and string) using the as
keyword
Example: scan x as integer;
Types available:
- 'string': scans a string and stops at white spaces, e.g: if input was 'some input', this will scan 'some'.
- 'number': scans an optionally floating number stops at white spaces, e.g: if input was '5.3 6.2', this will scan '5.3'.
- 'integer': same as 'number', But converts the returning value to an integer value, e.g: if input was '5.3 6.2', this will scan '5'.
- 'line': scans a whole line as a string stopping only at newlines, e.g: if input was 'some input', this will scan 'some input'.
You can scan multiple variables in one line of the same type.
Example: scan x, y as integer;