The when statements are just like if statements. After executing one, it goes on to the following statement which does not have to be a conditional statement. That is, you can mix when statements with plain unconditional statements.

If multiple when conditions match, it runs all of them. It's more like if statements, not like a C switch statement.
--John

Stephen Simmons (via RT) wrote:
# New Ticket Created by "Stephen Simmons" # Please include the string: [perl #58626] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=58626 >


In the attached code, there is a fairly simple example of a case statement
using given/when that has multiple clauses executed.  I assumed from my
reading of S04 that if one of the when block is taken, when it finishes
control exits the innermost given block, though the English is confusing to
me.  However it doesn't and continues on to both the when * clause and the
default clause.
Execution:
sully:perl6 stephensimmons$ adventure_world/a1b.p6
You are at (0, 0) within region outside.
n
Oops!;
What does n mean?
You are at (0, 1) within region outside.

Reply via email to