REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 17-Aug-2010 Edit History  

REBOL 3 Functions: all

all  block

Shortcut AND. Evaluates and returns at the first FALSE or NONE.


block [block!] - Block of expressions

See also:

any   and   or   case   switch  


The all function is the most common way to test multiple conditions, such as in the line:

if all [num > 1  num < 1000] [do something]

It works by evaluating each expression in a block until one of the expressions returns none! or false, in which case a none! is returned. Otherwise, the value of the last expression will be returned.

print all [1 none]
print all [none 1]
print all [1 2]
print all [10 > 1 "yes"]
print all [1 > 10 "yes"]
time: 10:30
if all [time > 10:00 time < 11:00] [print "time is now"]
time is now

No other expressions are evaluated beyond the point where a value fails:

a: 0
all [none a: 2]
print a
a: 0
all [1 a: 2]
print a
day: 10
time: 9:45
ready: all [day > 5  time < 10:00  time: 12:00]
print time

The any function is a companion of all to test for the opposite condition, where any one of the values will result in a true result.

  TOC < Back Next > - WIP Wiki Feedback Admin