13 lines
304 B
Raku
13 lines
304 B
Raku
|
# create a program that reports the type of number specified on the command line using 'given' block
|
||
|
|
||
|
sub MAIN ($number) {
|
||
|
given $number {
|
||
|
say "Number type: ", do given $number {
|
||
|
when Int { 'integer' }
|
||
|
when Complex { 'complex' }
|
||
|
when Rat { 'rat' }
|
||
|
default { 'unsupported type' }
|
||
|
}
|
||
|
}
|
||
|
}
|