1 # Copyright (C) 2007-2009, Parrot Foundation.
4 =head1 Logical Operations
6 The logical operations are short-circuiting, so if the first
7 argument to an 'or' is true, the second will never be
8 evaluated. If the first argument to an 'and' operation is
9 false, the other arguments are never evaluated either. This
10 is a common logical optimization used by compiler designers.
11 PIR only allows variables as arguments to operations, so the
12 short-circuiting is only relevant if the argument is a PMC
13 that has side-effects on access to the boolean value. We'll
14 talk about these side effects later.
20 $I0 = 0 && 1 # returns 0
21 $I1 = and 1, 2 # returns 2
23 $I2 = or 1, 0 # returns 1
24 $I3 = or 0, 2 # returns 2
41 # vim: expandtab shiftwidth=4 ft=pir: