Skip to content

Latest commit

 

History

History
53 lines (38 loc) · 1009 Bytes

if.md

File metadata and controls

53 lines (38 loc) · 1009 Bytes

if, unless, ife, unlesse, _if, _unless

The classical "if" (and its "unless" sidekick)

if
  > f.age 3
  set f.designation 'child' # then
  set f.designation 'baby' # else

if (f.age > 3)
  sequence # then
    set f.designation 'child'
  sequence # else
    set f.designation 'baby'
    order_baby_food _

Warning, the direct children are relevant. In the following snip, order_child_seat is considered the "else" part of the if

if (f.age > 3)
  set f.designation 'child'
  order_child_seat _

postfix if and unless

The flor parser will automatically turn

task 'bob' if a > b

into the syntax tree that would result from

if
  a > b
  task 'bob'

else-if

Currently, if an "else if" is needed, it's better to use cond.

see also

Cond, case, match.