Agena offers various flow control facilities such as:
- if/then/elif/else conditions,
- case of/else conditions similar to C's switch/case statements,
- is operator to return alternative values,
- numerical for/from/to/by loops where start, stop, and step values are optional, and automatic round-off error correction of iteration variables,
- combined numerical for/while loops,
- for/in loops over strings and complex data structures,
- while and do/as loops similar to Modula's while and repeat/until not() iterators,
- a skip statement to prematurely trigger the next iteration of a loop,
- a break statement to prematurely leave a loop,
- data type validation with the try/else statement and the optional double colon facility in parameter lists.
Data types provided are:
- rational and complex numbers, with extensions such as infinity and undefined,
- strings,
- Booleans such as true, false, and fail,
- the null value meaning 'nothing',
- multi-purpose tables implemented as associative arrays to hold any kind of data, taken from Lua,
- Cantor sets as collections of unique items,
- sequences, i.e. vectors, to internally store items in strict sequential order,
- pairs to hold two values or pass arguments in any order to procedures,
- user-defined types for sequences, tables, and pairs to allow for special-purpose handling,
- threads, userdata, and light user data inherited from Lua.
Procedures with full lexical scoping are supported, as well, and provide the following extensions:
- the << (args) -> expression >> syntax to easily define simple functions,
- remember tables to conduct recursion at high speed and at low memory consumption,
- remember tables for fast access to predefined results,
- user-defined types,
- the nargs system variable which holds the number of arguments actually passed to a procedure,
- metamethods inherited from Lua to define operations for tables, sets, sequences, and pairs.
For performance, most basic operations on these types were built into the Agena kernel.
Comments