learning-perl6/ch3/ex3-3.raku
2023-11-12 08:33:31 -08:00

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' }
}
}
}