create or convert floating-point numbers with Kernel's Float method : Convert to Float « Number « Ruby






create or convert floating-point numbers with Kernel's Float method


puts Float(167) # convert an integer
puts Float("77") # convert a string
puts Float(a) # convert a character code

 








Related examples in the same category

1.the percentage
2.Convert string to float
3.try weird conversions