How to check if the value of a number is an even or odd number?
#1
Heya, I was wondering if there was a way I could check if the value of a number is even or odd numbered through scripting. Is there? If so, how do I do it? :o
Reply }
#2
There has gotta be a simple MACL def to handle odd/even checking. Something like:
if my_test_value.is_a?(odd_value) or something
Reply }
#3
Code:
if number%2==0
  #even
else
  #odd
end
Reply }
#4
*Smacks forehead*
The % Remainder symbol. I totally forgot. Yep. That'll do it.
Reply }
#5
pwnt.
(I didn't see that coming, thought it was a trick question :l)
Reply }
#6
Oh man, thanks Charlie. :D
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Pausing script from processing for a number of frames firestalker5 8 11,247 04-25-2011, 10:04 AM
Last Post: deValdr
   Check player facing direction desbrina 5 7,644 06-20-2010, 09:58 PM
Last Post: deValdr
   how to check if a method has been aliased? Charlie Fleed 6 9,248 01-21-2010, 06:26 PM
Last Post: DerVVulfman
   How to check if actor has certain stat(s) with RGSS? Twin Matrix 4 9,773 01-04-2009, 05:35 PM
Last Post: Twin Matrix



Users browsing this thread: 1 Guest(s)