Language Statements
A script consists of one or more statements. A statement consists of the statement keyword followed by any required parameters and ending with a semicolon. Some of these statements may include one or more sub-statements in {} blocks. The core language statements are as follows:-
| Statement List | ||
|---|---|---|
| Statement | Use | Example |
| call | Run a predefined command. | call bold_write("Hello"); |
| command | Define a Command which can be called later. | command bold_write( mess ) { write "<b>" + mess + "</b>"; }; |
| constant | Create a constant value. | constant tau = pi * 2; |
| do | Loop through a script until a condition is met. | do { while y <= 2015; write "1 Jan " + y nl; y += 1; }; |
| exit | Stop running a script, command, function or do loop. | exit; |
| file | Define a file object for input and output. | file test append "text.txt"; |
| function | Define a Function which can be used in an expression. | function double( x ) { result = x * 2; }; |
| global | Initialise or change a global variable. | global paper = "A4"; |
| if | Run code depending on condition. | if value = 10 { write "<b>" + value + "</b>"; } else { write value; }; |
| let | Initialise or change a local variable. | let d = 1; |
| mark | Set a named mark in the script. | mark test1; |
| module | Immediately run the module script. | module file:math; |
| Allow codes to be referenced before their full definition. | module file:example { object pair; }; | |
| object | Define an Object for later use. | object pair { values first second; function sum { result = first + second; }; }; |
| set | Set a global default setting. | set context hics; |
| write | Create output. | write value1, value2 nl; |
This list may be extended by adding language extensions, such as Hics the calendar scheme extension.