Keywords
Assignment
Let
let <variable> = <value>
value
to variable
, in the current scope.If
variable
is already assigned in the current scope, then it throws an error.
Var
var <variable> = <value>
value
to variable
, in the global scope.If
variable
is already assigned, then it throws an error.
Const
const <variable> = <value>
value
to variable
, in the current scope.If
variable
is already assigned, then it throws an error.variable
cannot be re-assigned by any means.
Control Flow
If
if <condition>
...
end
condition
is truthy.
While
while <condition>
...
end
condition
is truthy.
Loop
loop <times>
...
end
times
amount of times.
Break
while true
break
end
If used outside of a while or loop, it throws an error.
Next
while true
next
print("This won't print")
end
If used outside of a while or loop, it throws an error.
Functional
Function
func <name>(<param1>,<param2>...)
...
end
name
and parameters param1
, param2
... etc.Functions can be called using the function call syntax.
Return
func example()
return <value>
print("This won't print")
end
value
as the result of calling the current function, and stops executing that function.If used outside of a function, it throws an error.