Conditional structures: Difference between revisions

Content added Content deleted
m (/* {{header|Perl 6}} * typo)
Line 3,646: Line 3,646:
when 'yes' { return }
when 'yes' { return }
when 'no' { next }
when 'no' { next }
default { say "Please answer either yes or not." }
default { say "Please answer either yes or no." }
}</lang>
}</lang>
<tt>when</tt> blocks are allowed in any block that topicalizes <tt>$_</tt>, including a
<tt>when</tt> blocks are allowed in any block that topicalizes <tt>$_</tt>, including a
Line 3,653: Line 3,653:


There are also statement modifier forms of all of the above.
There are also statement modifier forms of all of the above.

===Ternary operator===
===Ternary operator===
The [[wp:ternary operator|ternary operator]] looks like this:
The [[wp:ternary operator|ternary operator]] looks like this: