Return to Snippet

Revision: 34940
at October 30, 2010 17:18 by goatboy91587


Updated Code
/* Each trace function demonstrates the type 
   of Arithmetic operators in Flash.
   Commented out trace() functions demonstrate
   an easier to read example while the verbose
   versions represent cleaner formatting in 
   the console.*/
			
   //Addition
   trace("The sum of 15 + 6 is: " + (15 + 6)); 
   //trace(15 + 6);
   trace("\n");
			
   //Subtraction
   trace("The difference of 15 and 6 is: " + (15 - 6) );
   //trace(15 - 6);
   trace("\n");
			
   //Multiplication
   trace("The product of 15 and 6 is: " + (15 * 6));
   //trace(15 * 6);
   trace("\n");
			
   //Division
   trace("The quotient of 15 and 6 is: " + (15 / 6));
   //trace(15 / 6);
   trace("\n");
			
   //Modulo
   trace("The modulus (remainder) of 15 and 6 is: " + (15 % 6));
   //trace(15 % 6);
   trace("\n");

   //Order of Operations Example 1
   trace("Parentheticals take precedence in Arithmetic!");
   trace("(4 * 2) + 6 = " + ((4 * 2) + 6));
   //trace((4 * 2) + 6);
   trace("\n");
			
   //Order of Operations Example 2
   trace("(10 + 6) * 3 = " + ((10 + 6) * 3));
   trace("\n");
			
   //String Concatenation Example
   var concatSentence:String = "This is an example of " + "string concatenation.";
   trace(concatSentence);

Revision: 34939
at October 30, 2010 17:13 by goatboy91587


Updated Code
/* Each trace function demonstrates the type 
   of Arithmetic operators in Flash.
   Commented out trace() functions demonstrate
   an easier to read example while the verbose
   versions represent cleaner formatting in 
   the console.*/
			
   //Addition
   trace("The sum of 15 + 6 is: " + (15 + 6)); 
   //trace(15 + 6);
   trace("\n");
			
   //Subtraction
   trace("The difference of 15 and 6 is: " + (15 - 6) );
   //trace(15 - 6);
   trace("\n");
			
   //Multiplication
   trace("The product of 15 and 6 is: " + (15 * 6));
   //trace(15 * 6);
   trace("\n");
			
   //Division
   trace("The quotient of 15 and 6 is: " + (15 / 6));
   //trace(15 / 6);
   trace("\n");
			
   //Modulo
   trace("The modulus (remainder) of 15 and 6 is: " + (15 % 6));
   //trace(15 % 6);
   trace("\n");

   //Order of Operations Example 1
   trace("Parentheticals take precedence in Arithmetic!");
   trace("(4 * 2) + 6 = " + ((4 * 2) + 6));
   //trace((4 * 2) + 6);
   trace("\n");
			
   //Order of Operations Example 2
   trace("(10 + 6) * 3 = " + ((10 + 6) * 3));
   trace("\n");
			
   //String Concatenation Example
   var concatSentence:String = "This is an example " + "string concatenation.";
   trace(concatSentence);

Revision: 34938
at October 30, 2010 17:00 by goatboy91587


Initial Code
/* Each trace function demonstrates the type 
   of Arithmetic operators in Flash.
   Commented out trace() functions demonstrate
   an easier to read example while the verbose
   versions represent cleaner formatting in 
   the console.*/
			
   //Addition
   trace("The sum of 15 + 6 is: " + (15 + 6)); 
   //trace(15 + 6);
   trace("\n");
			
   //Subtraction
   trace("The difference of 15 and 6 is: " + (15 - 6) );
   //trace(15 - 6);
   trace("\n");
			
   //Multiplication
   trace("The product of 15 and 6 is: " + (15 * 6));
   //trace(15 * 6);
   trace("\n");
			
   //Division
   trace("The quotient of 15 and 6 is: " + (15 / 6));
   //trace(15 / 6);
   trace("\n");
			
   //Modulo
   trace("The modulus (remainder) of 15 and 6 is: " + (15 % 6));
   //trace(15 % 6);
   trace("\n");

   //Order of Operations Example 1
   trace("Parentheticals take precedence in Arithmetic!");
   trace("(4 * 2) + 6 = " + ((4 * 2) + 6));
   //trace((4 * 2) + 6);
   trace("\n");
			
   //Order of Operations Example 2
   trace("(10 + 6) * 3 = " + ((10 + 6) * 3));

Initial URL
http://www.brettwidmann.com

Initial Description
This snippet is used for the blog post called Arithmetic Operators in Flash and ActionScript 3.0, which can be found at http://www.brettwidmann.com/2010/10/arithmetic-operators-in-flashactionscript-3-0 which is set to publish on November 1, 2010.

Initial Title
ActionScript 3.0 Arithmetic Operators

Initial Tags
flash

Initial Language
ActionScript 3