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

if-else and statement-ending blocks?

From:
Markus Laire
Date:
October 5, 2006 11:43
Subject:
if-else and statement-ending blocks?
Message ID:
67d53e40610051143u661aa812g2a662313b6804d04@mail.gmail.com
S04 says:
>A line ending with a closing brace "}", followed by nothing but whitespace or
>comments, will terminate a statement if an end of statement can occur there.
>That is, these two statements are equivalent:
>
>    my $x = sub { 3 }
>    my $x = sub { 3 };

Does this mean that
  if $foo == 123 {
     ...
  }
  else {
    ...
  }
is same as
  if $foo == 123 {
     ...
  };  # <-- notice the semicolon here
  else {
    ...
  }
because if-statement could end there.

-- 
Markus Laire



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