RosettaCodeData/Task/Non-decimal-radices-Input/Ruby/non-decimal-radices-input-1.rb
Ingy döt Net 776bba907c Sync
2013-10-27 22:24:23 +00: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