Conditional notation is a way to specify a specific condition for Lagmite. In this case, it is denoted with <<>> and is highlighted orange. The notation format uses simple unknowns (#) or using the variables that are stated. Usually, this notation is used for the gen function. As an example, to generate the first 10 even numbers and squared, you can use the syntax:
disp [list] (gen [expr] #^2 <<calc [expr] #%2 == [expr] 0>> {1,10})
//Expected output: [4,16,36,64,100]
The operators that are used are:
≥ and ≤ which stand for less/more than or equal to.== which stands for equality.% operator for modulo.and and or as logical operators.Most conditional notation formats follow the examples below:
<<<variable>%2==1>> and <<<variable>%2==0>><<<variable>+3≥4>><<<variable>-20>21 and <variable>%3==0>>As an example, to show the word “math” when 1+6=7, we can use the syntax below:
disp [text] (calc [expr] 1+6)
disp [text] math <<[expr] ~== [expr] 7>>
//Expected output: math
Here, we utilized a simple known (~) to compare its value to 7, in which returns true, so it displays “math”.