![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
If you want to tell Smalltalk to convert a
number from one type to another explicitly, rather than relying on
automatic conversion, you
can use asInteger
or asFloat
. Note that
asInteger
rounds Float
instances:
3.01 asInteger <-- Round 3.01 to an integer, answering 3 3.99 asInteger <-- Round 3.99 to an integer, answering 4 -3.01 asInteger <-- Round 3.01 to an integer, answering -3 -3.99 asInteger <-- Round 3.99 to an integer, answering -4