/

 

The manual

Self-training

Experimentation

Contact

 

Language

Control Instructions

Conditional execution

Example:

var Float f
...
if f<0
  f := f+1

'shunt' is a compact form of 'if then else' equivalent to the notion 'cond? v1: v2 'in C language.
Example:

var Float x y
...
y := shunt x>=0 x -x # y reçoit la valeur absolue de x

Buckles

We also have the classic 'while' and 'for' instructions:

var Str s
while s<>""
  ...
  s := s 1 s:len

var Int i
for i 1 5
  ...

Errors

The 'error' instruction causes the error message to be displayed.
In addition, all the side effects (modified fields, files created, etc.) of a program which presents an error are canceled.

var Int n
...
if n>1000
  error "Trop grand !"