Copy link to clipboard
Copied
Hi. I have a timer going, that i want to reactivate every time the score is divisible by 6.
so, i wrote
public var number:uint;
if(score==number/6)
{
number = 6;
timer.start();
}
but that is wrong.
Can anyone help me write the notion of a number being divisible by 6.
thanks:)
You can use the modulus operator, which produces the remainder after dividing by a number...
if(number%6 == 0){
that being true says the number is divisible by 6
Copy link to clipboard
Copied
You can use the modulus operator, which produces the remainder after dividing by a number...
if(number%6 == 0){
that being true says the number is divisible by 6
Copy link to clipboard
Copied
I don't know what your variables mean but you can see if a number is evenly divisible by another number using mod:
if(score % 6 == 0){
Copy link to clipboard
Copied
Aw, Ned ya beat me - same minute even!
Copy link to clipboard
Copied
thanks folks!!
Copy link to clipboard
Copied
You're welcome