X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlsyn.pod;h=5d25a77f5c7a63d2c897adc36a7da98d695a5698;hb=f26f4a2f8b63c72a33468ddeeb9d0337f0892af6;hp=80df487622b2ae277845e44745c1b03014ee4281;hpb=cf48932e9c614884be015feecb615c4d42f6f135;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod index 80df487..5d25a77 100644 --- a/pod/perlsyn.pod +++ b/pod/perlsyn.pod @@ -94,8 +94,8 @@ expression. The only kind of simple statement is an expression evaluated for its side effects. Every simple statement must be terminated with a semicolon, unless it is the final statement in a block, in which case -the semicolon is optional. (A semicolon is still encouraged there if -the block takes up more than one line, because you may eventually add +the semicolon is optional. (A semicolon is still encouraged if the +block takes up more than one line, because you may eventually add another line.) Note that there are some operators like C and C that look like compound statements, but aren't (they're just TERMs in an expression), and thus need an explicit termination if used @@ -103,12 +103,11 @@ as the last item in a statement. =head2 Truth and Falsehood -A false value is C, the number 0, the string C<'0'> and the -empty string C<''>. Note that unlike some languages, these are three -distinctly different values. A true value is everything which is not -false. - -Note that while 0, 0.0 and C<'0'> are false, C<'0.0'> is true. +The number 0, the strings C<'0'> and C<''>, the empty list C<()>, and +C are all false in a boolean context. All other values are true. +Negation of a true value by C or C returns a special false value. +When evaluated as a string it is treated as C<''>, but as a number, it +is treated as 0. =head2 Statement Modifiers @@ -200,6 +199,8 @@ The following compound statements may be used to control flow: if (EXPR) BLOCK elsif (EXPR) BLOCK ... else BLOCK LABEL while (EXPR) BLOCK LABEL while (EXPR) BLOCK continue BLOCK + LABEL until (EXPR) BLOCK + LABEL until (EXPR) BLOCK continue BLOCK LABEL for (EXPR; EXPR; EXPR) BLOCK LABEL foreach VAR (LIST) BLOCK LABEL foreach VAR (LIST) BLOCK continue BLOCK @@ -224,6 +225,8 @@ the sense of the test is reversed. The C statement executes the block as long as the expression is true (does not evaluate to the null string C<""> or C<0> or C<"0">). +The C statement executes the block as long as the expression is +false. The LABEL is optional, and if present, consists of an identifier followed by a colon. The LABEL identifies the loop for the loop control statements C, C, and C.