Esta página no está disponible actualmente en Español. Si lo necesita, póngase en contacto con el servicio de asistencia de Icon (correo electrónico)

Useful Expressions

The Simple Language uses concepts from another language KernelF which has several useful tools for writing expressions in more visual formats. There are also some peculiarities with writing expressions that this guide hopes to explain.

Constants

Constants are defined using the val and can store an immutable value for use later.

constant

Blocks

Expressions in kernel F are singular lines by default. To use multiple lines, a block expression needs to be used. The value of a block will be the value of the last line within the block.

block expression

To use a block, type { within and <expr> cell

Records

To create instances of classes within an expression use the hashtag key. This will instantiate a record.

To choose the type of the record, move the curser to just after the hashtag and press Ctrl+Space to see the available types. If the type you are looking for is not in the list, check the record, or the value library it is from, has been imported at the top of the node.

record

To set the values of the record field’s type in the values just before the field name. If a field should be null use the keyword none. If a field is missing, press enter from within any field to add an entry to the end of the record.

Alternative

The alt expression is equivalent to a sequence of if-else blocks but is easier to read. The row’s condition on the left is tried in order from top to bottom, returning the value on the right. A final row with the keyword otherwise is used if all other checks fail.

alternative expression

To use this structure, type alt within any <expr> cell.

select alternative expression

Table

Similar to alt but for more complicated conditions, the table takes a column for each variable and a row for each value those variables can take. These rows are evaluated top to bottom, and the value in the final column is given as the response. Any blank cells are ignored in each check. The final row is the default case and should be left blank except for the response cell.

Multiple response columns can be given, which will result in a tuple as the response.

Below is an example of using a table for address validation:

example table

To use this structure, type multiDecTab within any <expr> cell

select table