Skip to content

Language Tour

hunterdyar edited this page Jun 9, 2024 · 2 revisions

Comments

Single line comments begin with //

//Comments

Multi line comments begin with /* and end with */.

/* This is a 
multi line

comment
*/

Literals

String Literals

String literals are defined with ' or ".

"This is a string literal."
'This is also a string literal.'
"string's"
"escape \" with backslash. Whatever character immediately follows the backslash will be parsed as a part of the string."

Number Literals

Numbers begin with a digit or a dot, and contain digits or the period. 10 10.0 .1 They will be parsed as integers. (note: floats not yet supported) Scrub parses hex, binary, and octal literals at compile time.

0xFF
0xff
0b001010
0o17

0x prefix for hexadecimal (case doesn't matter). 0b prefix for binary. 0o for octal.

Boolean Literal

The keywords true and false are parsed as bools.

Arrays

Array's use a square bracket notation. Create arrays with a comma separated list of values inside of brackets. Access an array with an indexer inside the bracket immediately after the array identifier.

Arrays are zero-indexed.

array = [1,2,"three"]
array[2]//"three"
Clone this wiki locally