0

What does " %" mean in Ruby please?

6th Jan 2017, 12:37 AM
John Maleckar
4 odpowiedzi
+ 7
3%2 is 1 2%3 is 2
6th Jan 2017, 5:15 AM
Hatsy Rei
Hatsy Rei - avatar
+ 3
Isn't 2%3 == 2?
6th Jan 2017, 2:21 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 2
it means module, the rest of the division. (2%3==1) //true
6th Jan 2017, 12:39 AM
Nahuel
Nahuel - avatar
0
it is used for modulus. it returns the remainder ex. 7℅2 = 1 since when we devide 7 by 2 it leaves 1 as remainder.
4th Feb 2017, 12:43 PM
Mohit Goyal
Mohit Goyal - avatar