Glich - v0.3.0 Manual
Statements
Home Development v0.3.0 Manual Glich Script Statements

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
StatementUseExample
callRun a predefined command.call bold_write("Hello");
commandDefine a Command which can be called later.command bold_write( mess ) { write "<b>" + mess + "</b>"; };
constantCreate a constant value.constant tau = pi * 2;
doLoop through a script until a condition is met.do { while y <= 2015; write "1 Jan " + y nl; y += 1; };
exitStop running a script, command, function or do loop.exit;
fileDefine a file object for input and output.file test append "text.txt";
functionDefine a Function which can be used in an expression.function double( x ) { result = x * 2; };
globalInitialise or change a global variable.global paper = "A4";
ifRun code depending on condition.if value = 10 { write "<b>" + value + "</b>"; } else { write value; };
letInitialise or change a local variable.let d = 1;
markSet a named mark in the script.mark test1;
moduleImmediately run the module script.module file:math;
Allow codes to be referenced before their full definition.module file:example { object pair; };
objectDefine an Object for later use.object pair { values first second; function sum { result = first + second; }; };
setSet a global default setting.set context hics;
writeCreate output.write value1, value2 nl;

This list may be extended by adding language extensions, such as Hics the calendar scheme extension.

Home Development v0.3.0 Manual Glich Script Statements

Managed by WebPageLayout Validated by HTML Validator (based on Tidy)

21st September 2024