Examples
output
Documents
Settlang is a statically typed programming language that expresses mutability by whether variables have setters.
Basic grammar and concepts are follow. See examples for details!
Type
- i32 : 32-bit signed integer
- i64 : 64-bit signed integer
- string : surrounded by ", can be used as a first argument of 'print' / 'println'
Expression
- arithmetric -> +, -, *, /, %
- compare -> ==, !=, <, <=, >=, >
- logical AND &&, logical OR ||
Variable
'let' varname ':' typename ('|' setter function name)? '=' expr
Setter is a funcion that returns new value of the variable. The return value type of setter and variablue type must match.
Standad library
- print(string, ...) -> void
- append string to output area
- println(string, ...) -> void
- append string to output area and break line
- alert(string, ...) -> void
- call window.alert()
- read(void) -> i64
- get input from user by using window.prompt()
- random(i64, i64) -> i64
- return random value (first args <= return value <= second args)