School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,145 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,730 people online right now. Registration is fast and FREE... Join Now!




AS2 find the remainder

 

AS2 find the remainder, need to know if something is divisible by 5 EXACTLY

Tom_Collier

6 Nov, 2009 - 01:04 PM
Post #1

New D.I.C Head
*

Joined: 17 Sep, 2009
Posts: 36


My Contributions
I Have one theory, if i make an integer variable = the result, will it round down always? or up sometimes?

if i write in a sort of psuedo code, this is what i want

CODE

variable score

if( score / 5 )= integer
make X happen
end if.


is this possible in as many lines of code, or will i need some advanced flash?

as i write this, i remember hearing about Math.Floor, but i'm unsure if that is what i'm looking for.

User is offlineProfile CardPM
+Quote Post


thehat

RE: AS2 Find The Remainder

8 Nov, 2009 - 02:00 PM
Post #2

awake ? web();
Group Icon

Joined: 28 Feb, 2008
Posts: 940



Thanked: 99 times
Dream Kudos: 200
My Contributions
you need the modulus operator(%) for this. Modulus divides one number by another and returns the result:
CODE

trace(26 % 5); //gives 1
trace(25 % 5); //gives 0

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 03:47PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month