develooper Front page | perl.perl6.language | Postings from June 2006

statement-ending } with if

From:
Daniel Hulme
Date:
June 6, 2006 09:26
Subject:
statement-ending } with if
Message ID:
20060606162605.GA22881@istic.org
Can someone explain to me how } on a line on its own can end a statement
(as described in the second section of S04), but the following still
works?

if $condition
{
  ...
}
else
{
  ...
}

i.e. Why doesn't the } on the fourth line terminate the if statement,
leaving the compiler terminally confused when it sees a bare else? Is
this defined as a special case, and if so, could it be mentioned in S04?
Alternatively, is the else a magic separate statement all of its own?

-- 
And for mile after mile you'll never see me tire/You'll never me me slow
down for a while/'Cause I am the fox, like it or not/I'm always gonna be
there  running over the rock/ Yes I am the fox,  a fascinating cross/ Of
sharp as a whip and tough as an ox              Bernie Taupin, 'The Fox'



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About