integer_vs_float
🔢 Distinguish Integers and Floats​
Ruby has Integer and Float types for whole and decimal numbers. Use Integer for exact whole values and Float for numbers with fractional parts. You can check the class of a number with the .class
method.
age = 30 # Integer
price = 19.99 # Float
puts age.class # => Integer
puts price.class # => Float