Home Segments Index Top Previous Next

163: Mainline

Both the and: and or: methods take blocks as arguments:

receiver expression and: argument block 
receiver expression or: argument block 

If the receiver of an and: message is false, the argument block is ignored, and the value of the expression is false.

If the receiver of an or: message is true, the argument block is ignored, and the value of the expression is true.

Thus, for the and: message, the argument block is evaluated only if the receiver is true, and the value of the expression is the value of the block. For the or: message, the argument block is evaluated only if the receiver is false, and the value of the expression is the value of the block.