REBOL 3 Docs | Guide | Concepts | Functions | Datatypes | Errors |
TOC < Back Next > | Updated: 17-Aug-2010 Edit History |
Shortcut AND. Evaluates and returns at the first FALSE or NONE.
Arguments:
block [block!] - Block of expressions
See also:
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]
none
print all [none 1]
none
print all [1 2]
2
print all [10 > 1 "yes"]
yes
print all [1 > 10 "yes"]
none
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
0
a: 0
all [1 a: 2]
print a
2
day: 10
time: 9:45
ready: all [day > 5 time < 10:00 time: 12:00]
print time
12:00
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 > | REBOL.com - WIP Wiki | Feedback Admin |