Skip to content

Latest commit

 

History

History
18 lines (12 loc) · 543 Bytes

division.md

File metadata and controls

18 lines (12 loc) · 543 Bytes

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