ch3 progress

This commit is contained in:
drudge 2023-11-12 08:33:31 -08:00
parent 55b2d1d21f
commit f12da1bc9b
3 changed files with 23 additions and 0 deletions

5
ch3/ex3-1.raku Normal file
View file

@ -0,0 +1,5 @@
say 137.^name;
say (-17).^name;
say 3.14.^name;
say 6.026e34.^name;
say (0+i).^name;

6
ch3/ex3-2.raku Normal file
View file

@ -0,0 +1,6 @@
# Take 2 arguments from command line, output their types
sub MAIN ($arg1, $arg2) {
say "arg1 type is {$arg1.^name}";
say "arg2 type is {$arg2.^name}";
}

12
ch3/ex3-3.raku Normal file
View file

@ -0,0 +1,12 @@
# 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' }
}
}
}