From: Stefano Crocco Date: 2010-07-21T19:28:42+09:00 Subject: Re: How to check if x is a multiple of y On Wednesday 21 July 2010, Tom Ha wrote: > |Hi there, > | > |what's the most simple solution in Ruby to check if value x is a > |multiple of y? > | > | "if x/y.integer?" > | > |...is obviously not the solution. > | > |Thanks a lot! > |Tom Assuming x and y are both integers, you can use the modulo operator: if (x%y) == 0 ... Stefano