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

REBOL 3 Functions: and

and  value1  value2

Returns the first value ANDed with the second.

Arguments:

value1 [logic! integer! char! tuple! binary! bitset! typeset! datatype!]

value2 [logic! integer! char! tuple! binary! bitset! typeset! datatype!]

See also:

or   all   not   xor   logic?   integer?  

Description

For logic! values, both values must be true to return true, otherwise a false is returned. AND is an infix operator.

print true and true
true
print true and false
false
print (10 < 20) and (20 > 15)
true
Programming style

It's usually better to use all for anding conditional logic, such as the example above.

if all [10 < 20 20 > 15] ...

For integer!, tuple!, binary!, and other datatypes, each bit is separately anded.

print 123 and 1
1
print 1.2.3.4 and 255.0.255.0
1.0.3.0


  TOC < Back Next > REBOL.com - WIP Wiki Feedback Admin