From: "Joseph E. Savard" Date: 2010-07-21T23:26:58+09:00 Subject: Re: How to check if x is a multiple of y x = 9 y = 3 puts "yep" if (x%y).zero? x = 9 y = 2 puts "nope" if !(x%y).zero? > From: Tom Ha > Reply-To: > Newsgroups: comp.lang.ruby > Date: Wed, 21 Jul 2010 19:12:30 +0900 > To: ruby-talk ML > Subject: How to check if x is a multiple of y > > 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 > -- > Posted via http://www.ruby-forum.com/. >