- Language Reference
- if
- elif
- else
- case
- switch
- break
- continue
- do
- while
- try
- catch
- in
- where
- for
- ... any javascript reserved words
a = 5
This transpiles to const a = 5 if there is no re-assignment otherwise let a = 5
The default is always to return undefined or the last declared variable
foo = ()
This transpiles to const foo = () => { return undefined }
foo = (
@ a
@ b
a + b
)
or
foo = (
@ a, b
a + b
)
This transpiles to
const foo = (a, b) => { const generated_id = a + b return genetrated_id }
if expression {
// code
} elif expression {
// code
} else {
// code
}
This transpiles to the traditional javscript if / else if / and else
switch expression {
case 'case1' {
// code
}
case 'case2' {
// code
}
}
This transpiles to the traditional javascript switch and case statement with breaks
for x in obj {
// code
}
Transpiles to javascript for-in loop if obj is a dict and for-of if obj is any other object
while expression {
// code
}
Transpiles to javascript while loop
do {
// code
while expression
}
Transpiles to javascript do-while loop
x = [ variable.x for variable in arr where variable.x > 5 ]
Transpiles to const x = arr.filter( elem => elem.x > 5 ).map( elem => elem.x )
a = 'Hello'
print(a[1])
This prints 'e' and transpiles to console.log(a.substring(1,2)) if a is a string
a = [1,2,3]
print(a[1])
This prints '2' and transpiles to console.log(a[1])
a = [0, 4, 5][4]
onError(
@ error
print(error)
)
To add error handling, simply declare the a function that handles errors using the onError keyword
& and
| or
+ plus
- minus
/ divide
* multiply
^ exponent
// floor division
and
or
is
isnt
===
==