learning-perl6/ch3/ex3-3.raku

13 lines
304 B
Raku
Raw Normal View History

2023-11-12 16:33:31 +00:00
# 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' }
}
}
}