til

Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as an open source contributor and product manager

View project on GitHub

Division in Ruby

The division operator in Ruby returns an integer if both operands are integers. This is different from other programming languages, such as Python, where the division operator returns a float.

9 / 5  #=> 1

By adding a decimal point to one of the operands, the division operator will return a float.

9.0 / 5  #=> 1.8
9 / 5.0  #=> 1.8

Resources and References