Numbers
Syntax
Decimal
puts 3.14 // 3.14
puts 2.5 // 2.5
puts 1234 // 1234
puts 98 // 98
Hexadecimal
puts 0xff // 255
puts 0xABC // 2748
Binary
To write binary number, use '0b' prefix and binary digits (0 or 1).
puts 0b1 // 1
puts 0b100 // 4
Implementation notes
// just a double
Last updated
Was this helpful?