June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -1,7 +1,6 @@
|
|||
my Int:D $i = 1; # if $i has to be defined you must provide a default value
|
||||
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
|
||||
with 0 { say '0 may not divide but it is defined' }
|
||||
|
|
|
|||
11
Task/Undefined-values/Ring/undefined-values.ring
Normal file
11
Task/Undefined-values/Ring/undefined-values.ring
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Project : Undefined values
|
||||
# Date : 2018/03/27
|
||||
# Author : Gal Zsolt [~ CalmoSoft ~]
|
||||
# Email : <calmosoft@gmail.com>
|
||||
|
||||
test()
|
||||
func test
|
||||
x=10 y=20
|
||||
see islocal("x") + nl +
|
||||
islocal("y") + nl +
|
||||
islocal("z") + nl
|
||||
Loading…
Add table
Add a link
Reference in a new issue