I've tried the code
|myNum| myNum := SmallInteger new: 0. Transcript show: (myNum printString).
, but Pharo crashes upon running this code.
You can't create a SmallInteger using new:. You already have the number you want to print. It's already a SmallInteger. Just use it like such:
new:
Transcript show: 0 printString
"SmallInteger new: 0" is not necessary since 0 is already a SmallInteger.
Besides, the #show: message of the Transcript object already sends #asString to its parameter, therefore it can receive any object.
So the correct code would be:
Transcript show: 0
Copyright © 2021 Jogjafile Inc.
You can't create a SmallInteger using
new:
. You already have the number you want to print. It's already a SmallInteger. Just use it like such: