RosettaCodeData/Task/Non-decimal-radices-Input/Ruby/non-decimal-radices-input-1.rb
2023-07-01 13:44:08 -04:00

9 lines
168 B
Ruby

dec1 = "0123459"
hex2 = "abcf123"
oct3 = "7651"
bin4 = "101011001"
p dec1.to_i # => 123459
p hex2.hex # => 180154659
p oct3.oct # => 4009
# nothing for binary