Hymn Script
Home Learn Play Download Source Dark

Syntax


Comments

Code comments start with a pound sign `#` and end at the next new line.

# I am a comment

Scope

Variable scope uses curly brackets `{` and `}`. Variables in an inner scope will shadow the same identifiers in an outer or global scope.

set x = 0
{
  set x = 1
  {
    set x = 2
  }
}

Special Variables

GLOBALS Table of all global variables
PATHS List of possible paths to find scripts
IMPORTS Table of absolute paths for imported scripts

Reserved Words

and Logical operator where two conditionals must be true
break Breaks out of the current loop
continue Continues on to the next iteration of the current loop
elif Used for an additional conditional statement following an if statement
else Non-matching condition as part of an if statement
except Used at the end of a try block to capture an exception
false Boolean false value
for Creates a loop to iterate over a value or sequence
func Defines a new function
if Creates a conditional statement
in Used in a for loop for specifying a value to iterate over
set Used to declare a new variable
none None type that represents the absence of a value
or Logical operator where one or both conditions must be true
return Exits the current function
throw Generates an exception
true Boolean true value
try Begins a try block
use Imports a Hymn script
while Creates a loop that will not end until the given condition is true

Back to Table of Contents Learn Built-ins