in reply to if/else syntax
Brackets are mandatory on if statements in Perl.
Note that, unlike C and Pascal, these are defined in terms of BLOCKs, not statements. This means that the curly brackets are required--no dangling statements allowed.
The optionality of the brackets is a source of problems for C.
In Perl 6, it's the parens around the condition that are optional. They're already optional around the condition of statement modifiers in Perl 5.
someFunc() if ($someVar == $anotherVar); someFunc() if $someVar == $anotherVar; # Same thing
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: if/else syntax
by Anonymous Monk on Jun 26, 2009 at 15:48 UTC | |
by ikegami (Patriarch) on Jun 26, 2009 at 16:49 UTC | |
by Anonymous Monk on Jun 26, 2009 at 17:05 UTC | |
by Crackers2 (Parson) on Jun 26, 2009 at 16:10 UTC | |
by gwadej (Chaplain) on Jun 26, 2009 at 16:44 UTC | |
by Anonymous Monk on Jun 26, 2009 at 17:01 UTC | |
by ikegami (Patriarch) on Jun 26, 2009 at 17:20 UTC | |
by massa (Hermit) on Jun 26, 2009 at 17:33 UTC | |
by gwadej (Chaplain) on Jun 29, 2009 at 13:34 UTC | |
by Anonymous Monk on Jun 26, 2009 at 16:27 UTC | |
by Transient (Hermit) on Jun 26, 2009 at 17:21 UTC | |
by dreadpiratepeter (Priest) on Jun 26, 2009 at 15:51 UTC |