Control flow with sequences
Factor handbook > The language > Collections > Sequence operations

Prev:Numeric ranges
Next:Unsafe sequence operations


To reduce the boilerplate of checking if a sequence is empty, several combinators are provided.

Checking if a sequence is empty:
if-empty ( ..a seq quot1: ( ..a -- ..b ) quot2: ( ..a seq -- ..b ) -- ..b )

when-empty ( seq quot -- )

unless-empty ( seq quot -- )