ID:155075   Sep 26 2011, 11:51 am I was wondering if anyone knows a way to have a procedure happen exactly 50% of the time. I'm not taking about using prob(50) or pick(A,B) or whatever. For example I'd like a projectile to move 2 steps, then create another object. Any ideas?
 <-> Sep 26 2011, 12:04 pm Modulus! ```for(var/n in 1 to 10) if(!(n % 2)) world << n ```
 <-> Sep 26 2011, 12:12 pm In response to Kaiochao Kaiochao wrote: Modulus! ```> for(var/n in 1 to 10)> if(!(n % 2))> world << nAh thank you, do you possibly think you could go into a bit of detail how this works? I'd like to use this for future reference as well ```
 <-> Sep 26 2011, 12:15 pm In response to AbdelJN Check the DM Reference entry for the % operator. It simply gives the remainder of A divided by B. In the example I provided, it checks if A%B is 0, which is the case in even numbers divided by 2.
 <-> Sep 26 2011, 12:25 pm In response to Kaiochao Kaiochao wrote: Check the DM Reference entry for the % operator. It simply gives the remainder of A divided by B. In the example I provided, it checks if A%B is 0, which is the case in even numbers divided by 2. Alright but not all even numbers divided by 2 equals 0 so the example doesn't really work unless I'm missing something.
 <-> Sep 26 2011, 2:38 pm In response to AbdelJN Name a single even number that, divided by 2, leaves a remainder that is not 0.
 <-> Sep 26 2011, 2:46 pm In response to Robertbanks2 Robertbanks2 wrote: Name a single even number that, divided by 2, leaves a remainder that is not 0. Sorry, I misunderstood. I saw the % operator as solely giving the quotient of two numbers. Then I read again and found that it gives the remainder. As for your example Kaiochao, it's correct. Thanks:)