Expressing conditionals with boolean logic
Factor handbook » The language » Combinators » Conditional combinators

Prev:case ( obj assoc -- )


Certain simple conditional forms can be expressed in a simpler manner using boolean logic.

The following three lines are equivalent:
[ drop f ] unless swap and and*

The following three lines are equivalent:
or? [ ] [ ] ?if swap or or*

The following two lines are equivalent, where L is a literal:
[ L ] unless* L or