Name a value and give it a type
THE BASIC LANGUAGE
A ticket counter needs a starting quantity, a sale, and a number of seats left. DIM gives a changing value a name. CONST holds the capacity steady.
FUNCTION Run()
CONST capacity AS Integer = 8
DIM sold AS Integer = 3
sold += 2
DIM spare = capacity - sold
RETURN spare
END FUNCTIONWhat you should see The function returns 3. Five tickets were sold, leaving three seats. The += on the fourth line adds two to the existing value.
| Integer / Number | Use Integer to count items and Number for fractional values such as seconds. Long is an Integer alias. Single, Double and Decimal map to Number. |
|---|---|
| String / Boolean | String or Text holds words, including an empty string. Boolean holds TRUE or FALSE. |
| Array / Dictionary | An Array holds entries in order. A Dictionary stores values under keys such as "owner". |
| Variant / NOTHING | A value can be left untyped. NOTHING represents an absent value. An empty string is a piece of text with zero characters. |
The AS annotation is optional. Use it when the expected kind of value helps someone understand the function or gives the validator a useful check.
