Skip to content

Keywords

Assignment

Let

let <variable> = <value>
Assigns 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>
Assigns value to variable, in the global scope.
If variable is already assigned, then it throws an error.

Const

const <variable> = <value>
Assigns 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
Executes the code in the given block if condition is truthy.

While

while <condition>
  ...
end
Repeatedly executes the code in the given block while condition is truthy.

Loop

loop <times>
  ...
end
Repeatedly executes the code in the given block times amount of times.

Break

while true
  break
end
Exits the current loop.
If used outside of a while or loop, it throws an error.

Next

while true
  next
  print("This won't print")
end
Stops executing the code, and goes to the next iteration of the loop.
If used outside of a while or loop, it throws an error.

Functional

Function

func <name>(<param1>,<param2>...)
  ...
end
Defines a function with the name 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
Sets value as the result of calling the current function, and stops executing that function.
If used outside of a function, it throws an error.