Expressing conditionals with boolean logic

Factor handbook » The language » Combinators » Conditional combinators

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 two lines are equivalent:

The following two lines are equivalent:

The following two lines are equivalent, where L is a literal:

The following two lines are equivalent:

[ drop f ] unless
swap and

The following two lines are equivalent:

[ ] [ ] ?if
swap or

The following two lines are equivalent, where L is a literal:

[ L ] unless*
L or