Ruby program to convert the string into a floating-point number

Sometimes we get frustrated if we do not get the information we need in some articles. But this article has all the information you need when you read Ruby program to convert the string into a floating-point number. Read patiently and understand.

Ruby program to convert the string into a floating-point number

Ruby program to convert the string into a floating-point number

# Ruby program to convert the string 
# into a floating-point number

str = "10.5";
result = str.to_f();  

print "Result: ",result;
Result: 10.5

Final Words

We hope the Ruby program to convert the string into a floating-point number article helped you in some way. And let us know if you have any doubts. Thanks

Hi, I'm Selva a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Deekshi. Here, I post about programming to help developers.

Share on:

Leave a Comment