+ 1

Division in Ruby

I know Ruby allows division with the / symbol. But, for example, 5 / 2 is 2. If I want it to be 2.5, what symbol do I have to use?

2nd Jul 2017, 4:11 PM
Álvaro Estévez López
Álvaro Estévez López - avatar
2 odpowiedzi
+ 8
#Use a floating point like puts 5/2.0 #^_^
2nd Jul 2017, 4:18 PM
Ekansh
+ 1
Thanks!
2nd Jul 2017, 4:59 PM
Álvaro Estévez López
Álvaro Estévez López - avatar