Programming, Technology, Web Development, Whatever
Posts tagged division
Integer Division In Flex/Actionscript
Jan 18th
If you’re used to C and other elemental high level programming languages, you know that 5÷9 = 0 and 10÷7 = 1. ActionScript being higher level than C automatically coerces the quotient of two numbers to the Number class, producing a decimal. To get the correct integer quotient, use the Math.floor function, which drops the decimal.
//This produces 4 var integer:int = Math.floor(14/3);