Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help Number Multiples
#11
uhm
lol
in my code i wrote an else...
but ive forgot it here
Reply

#12
(04-20-2011, 01:27)AZUMIKKEL Wrote:
(04-20-2011, 01:15)master131 Wrote: % is the modulus operator. It gets the remainder when you divide a number by the other.
5 % 2 = 1 (5 divided by 2 has a remainder of 1)

So it rounds the number down and calculates the amount it rounded down?

So 8/3 would be 2,(2/3). 0,(2/3)*3 = 2 ?



I wonder what this would ever be handy for.

Maybe to check if a number is even or odd?
Code:
if(someNumber % 2 == 0) //If number is even (can be divided by 2 with no remainder)
    //Do crap here
else //Number is odd
   //Do crap here
[Image: 30xhrep.png]

A casual conversation between barata and I about Nukem.
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Your phone number? kokole 10 5,911 01-18-2013, 19:59
Last Post: JariZ
  exceeded maximum number of child1 script variables xplosiff 6 7,640 01-07-2012, 11:46
Last Post: xplosiff
Sad [Request] Weapon Change after certain Number of kills Scripts18 5 2,906 09-17-2011, 13:13
Last Post: Scripts18
  [SOLVED] Removing the xp gain number from medal messages Cyborgking 7 4,439 09-15-2011, 16:05
Last Post: Cyborgking
  [Release] Getting the number after the point Pozzuh 7 4,151 09-01-2011, 18:51
Last Post: SuperNovaAO

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.