27 lines
449 B
Plaintext
27 lines
449 B
Plaintext
class Integer < Value
|
|
int digit()
|
|
if_plus( self - 10)
|
|
return 32
|
|
else
|
|
Word numbers = "0123456789"
|
|
return numbers.at(self)
|
|
end
|
|
end
|
|
|
|
Word as_string(Word str)
|
|
if_minus( self - 10 )
|
|
int num = digit()
|
|
str = str.add_digit( num )
|
|
else
|
|
int rest = self / 10
|
|
str = rest.as_string( str )
|
|
end
|
|
return str
|
|
end
|
|
|
|
Word to_s()
|
|
Word start = " "
|
|
return as_string( start )
|
|
end
|
|
end
|