RosettaCodeData/Task/Non-decimal-radices-Input/Ruby/non-decimal-radices-input-2.rb
Ingy döt Net 776bba907c Sync
2013-10-27 22:24:23 +00:00

5 lines
221 B
Ruby

p dec1.to_i(10) # => 123459
p hex2.to_i(16) # => 180154659
p oct3.to_i(8) # => 4009
p bin4.to_i(2) # => 345
p "xyz9".to_i(10) # => 0 If there is not a valid letter, 0 is returned.