Hi everyone!

I solved the (easy) problem 32, implementing gcd($a,$b).

You can check the code in the repository or on the web[1]
But while writing this I noticed that a function written as

 sub gcd(Int $a, Int $b)

still accepts float/rational values in input.
I think I read once that a variable of type Int would accept these kind of assignment but that the value would be coerced to the new type of the variable, i.e.

 my Int $a= 10.1 #=> 10

Could someone explain me what is the expected behaviour?

[1] http://sial.org/pbot/22088


--

blog en: http://www.riffraff.info
blog it: http://riffraff.blogsome.com
jabber : rff.rff at gmail dot com

Reply via email to