DEV Community

jazmineubanks
jazmineubanks

Posted on

TIL 3/20/23

Today I have continued to work in ruby. I have worked on integers, float, and strings. I am currently struggling with Integers and float. Today my teacher assistant cleared up what gets.chomp means. Apparently I have been using it all wrong.

Currently I am on float and this is my question to complete:

Output ten divided by 3 rounded to 3 decimal places

I feel like I am overthinking it. I have tried different variations but I cannot figure out how to round it to the 3rd decimal.
My answer at the moment is: p 10 / 3.round(3).to_f
the output keeps coming out as 3.333333333333

I will work on figuring this out tonight!

Top comments (0)