Next: , Previous: , Up: Top  


15 Control Flow

Though looping statements are not necessary in k9, if-then-else statements are sometimes useful.

$[b;t;f] cond

15.1 cond ⇒ $[b;t;f]

If b is non zero then x else y. x and y are not required to be of the same type.

 $[3>2;`a;`b]
`a

 $[2>3;`a;`b]
`b

 $[37;12;10]
12

 $[1b;`a`b!(1 2;3 4);`n]
a|1 2
b|3 4

 $[1b;a:3;b:2]
3
 a
3
 b   / is not set as the f case not evaluated
!value