On Tue, Apr 17, 2007 at 07:34:38PM -0400, Joe Gottman wrote:
: [EMAIL PROTECTED] wrote:
: >+
: >+The value of the conditional expression may be optionally bound to
: >+a closure parameter:
: >+
: >+ if testa() -> $a { say $a }
: >+ elsif testb() -> $b { say $b }
: >+ else -> $b { say $b }
: >
: I'd prefer it if the result of a test in an if or elsif were usable in
: all subsequent elsif or else statements in the same if .. elsif .. else
: clause, so you could do something like
:
: if testa() -> $a {say "$a is true"}
: elsif testb() -> $b say {"$a is false and $b is true"}
: else say {"Neither $a nor $b is true"}
Sorry, that sort of P5ish chicanery with implicitly propagated scopes
violates the simplified rules of scoping in P6. If you really want
that, you'll have to say:
if my $a = testa() { say "$a is true"}
elsif my $b = testb() { say "$a is false and $b is true"}
else { say "Neither $a nor $b is true"}
and live with the fact that $a and $b are also visible after the construct.
Larry