On Tue, Nov 18, 2003 at 11:05:57AM -0800, Michael Lazzaro wrote:
> 
> On Tuesday, November 18, 2003, at 06:38 AM, Simon Cozens wrote:
> >Given that we've introduced the concept of "if" having a return status:
> >
> >  my $result = if ($a) { $a } else { $b };
> >
> 
> Would that then imply that
> 
>     sub blah {
>       ...              # 1
>       return if $a;    # 2
>       ...              # 3
>     }
> 
> ...would return $a if $a was true,

That makes no sense.  Besides in the above fantasy, the result of the
"if" is the last thing evaluated in the block.  In this case, the
block is a single "return" statement.  Perhaps it would be clearer
thusly:

        my $result = if ($a) { $b } else { $c };        # Same as ...
        my $result = ($a) ?? $b :: $c;                  # ?

> and fall through to (3) if it was 
> false?

Of course, that's how it works :)

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to