• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

'divisible by' help: how do you write 'a number is divisible by 6'?

Explorer ,
Mar 23, 2012 Mar 23, 2012

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:)

TOPICS
ActionScript

Views

8.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Mar 23, 2012 Mar 23, 2012

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

Votes

Translate

Translate
LEGEND ,
Mar 23, 2012 Mar 23, 2012

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 23, 2012 Mar 23, 2012

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){

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 23, 2012 Mar 23, 2012

Copy link to clipboard

Copied

Aw, Ned ya beat me - same minute even!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 23, 2012 Mar 23, 2012

Copy link to clipboard

Copied

thanks folks!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 23, 2012 Mar 23, 2012

Copy link to clipboard

Copied

LATEST

You're welcome

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines