Overview Module Function Class Tea 3.2.4 Reference Documentation
© 2009 PDM&FC

Function and

and [obj1 ...]

Calculates the logical conjunction of a set of boolean values.

Parameters:
obj1 - A boolean object or a block that evaluates to a boolean value.
Returns:
A boolean value representing the logical conjunction of its arguments.

The and can receive code blocks as arguments. The arguments are inspected from left to right. If one argument is a code block then it is evalueted and the result must be a boolean object. If that code bock evaluated to false then no more arguements are checked. That means that if there are more arguments that are code blocks then tey will not be evaluated. This is usefull if you have a condition that may only be evaluated if a previous condition is true. For example:
if { and {not-null? $x} {== $x 0} {
    do-whatever
}

the second condition may only be evaluated if the first condition is true. The use of code blocks as arguments insures that the and function behaves the intended way.

If the and function is called with no arguments it will return true.


Overview Module Function Class Tea 3.2.4 Reference Documentation
© 2009 PDM&FC
Report a bug or request new features
© 2009