try weird conversions : Convert to Float « Number « Ruby






try weird conversions


puts '15'.to_f
puts '99.999'.to_f
puts '99.999'.to_i
puts ''
puts '5 is!'.to_i
puts 'about 5'.to_i
puts 'Your'.to_f
puts ''
puts 'stringy'.to_s
puts 3.to_i

 








Related examples in the same category

1.create or convert floating-point numbers with Kernel's Float method
2.the percentage
3.Convert string to float