Language Statements
A script consists of one or more statements. Some of these statements may include one or more sub-statements. The base 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; loop |
end | Stop running a script, command or function. | end; |
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; endif |
let | Initialise or change a local variable. | let d = 1; |
mark | Set a named mark in the script. | mark "test1"; |
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; |
writeln | Create output, followed by a new line. | writeln.fname "Date: " + today_str; |
This list may be extended by adding language extensions, such as Hics the calendar scheme extension.