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

This documentation was generated offline from a
`load-all`

image. If you want, you can also
browse the documentation from within the UI developer tools. See
the Factor website
for more information.

Factor 0.99 x86.64 (2173, heads/master-f3ee5c5979, Sep 18 2022 13:17:51)