On 2019-11-30 08:37, Veesh Goldman wrote:
Also, you may want to use the divisibility operator %% instead of
modulo. I think
if $i %% 2
Is clearer to read.
Hi Veesh,
Indeed! Thank you. Modulus (%) is burned into my head.
Now all I have to do is remember divisible (%%).
:-)
Thank you.
-T
My notes:
Perl6: divisible: %%
Divisible by 2
$ perl6 -e "if 3 %% 2 {say 'even'}else{say 'odd'; }"
odd
With modulus: %
$ perl6 -e "if 3 % 2 == 1 {say 'even'}else{say 'odd'; }"
even
$ perl6 -e "if 3 % 2 == 1 {say 'odd'}else{say 'een'; }"
odd