Thom Boyer wrote:
> The primary advantage, to my mind, in using C<elsif>, is that it
> eliminates the dangling-else ambiguity -- so splitting it in half
> removes almost ALL the value of even having an C<elsif> keyword.
Surely it's the compulsory braces, even with a single statement, which
eliminates that problem?
These look ambiguous to me, with no C<else if> required:
if test1
if test2
statement_A;
else
statement_B;
if test1
if test2
statement_A;
else
statement_B;
Where as putting the braces in there always disambiguates which C<if>
and C<else> goes with:
if test1 {
if test2 {
statement_A;
}
else {
statement_B;
}
}
if test1 {
if test2 {
statement_A;
}
}
else
{
statement_B;
}
Smylers