Undefined values: Difference between revisions

m
→‎{{header|Perl 6}}: Remove nyi, speculative type smiley example
No edit summary
m (→‎{{header|Perl 6}}: Remove nyi, speculative type smiley example)
Line 898:
multi sub foo(Int:D $i where * != 0){ (0..100).roll / $i } # we will never divide by 0
multi sub foo(Int:U $i){ die 'WELP! $i is undefined' } # because undefinedness is deadly
multi sub foo(Int:_ where * == 0){ die q{I'm sorry, Dave, I'm afraid I can't do that.} }
 
with $i { say 'defined' } # as "if" is looking for Bool::True, "with" is looking for *.defined
10,333

edits