The size
property of an integer is used to get the number of bytes in the machine representation of int
(machine-dependent).
integer.size
The value returned is an integer, which represents the number of bytes in the machine representation of an integer.
# create integer valuesint1 = 10int2 = 256**20 + 1int3 = 256**10 - 1int4 = 300 **4 - 3# get sizeputs "#{int1.size}"puts "#{int2.size}"puts "#{int3.size}"puts "#{int4.size}"
size
property to get the number of bytes of the integers. And then, we print the results to the console.