Any way on how to do 5x1, 5x2, 5x3 with 1 line?
#1

I am making something and I want to do that someone gets more bullets at 5, 10, 15, 20 etc..

So instead of case 5,10,15. Is there any line I could replace this with?
Reply
#2

Modulus operator (%). Gives you the remainder of the division, e.g.:

pawn Код:
25 / 5 is 5 and the remainder is 0 -->> ((5 * 5) + 0) = 25
23 / 5 is 4 and the remainder is 3 -->> ((4 * 5) + 3) = 23
Ergo, if the remainder is 0 then you know that the value is a multiple of the divisor.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)