Answer To Math Question
This video is a revision and practice to help understand new concepts learned in the last video. We'll follow all the steps mentioned in the previous video to get an answer to a complicated math equation. When we evaluate the equation according to the priority of the math symbols, the calculation becomes easier. So, practical knowledge on evaluating the math equation is a must before moving forward in the courses.
Lets review this with an example: (2-3)*3+8/(4-2). When we write this equation in trace without double quotes, Flash evaluates the final answer and prints it on the output panel. Let's now discuss the steps taken by Flash to evaluate the answer to this equation.
Firstly, the highest priority symbols will be evaluated as discussed earlier. We can see that the order of priority in this equation is
- () – whatever is in parenthesis is calculated first.
- * or / – multiplication or division next
- + or - – addition or subtraction last
So (2-3) and (4-2) are evaluated first which gives the first result: -1*3+8/2. We know that * and / are higher priority than + and -, so after the next evaluation the penultimate answer is -3+4. This is evaluated easily as 4-3 which gives the answer 1. Therefore anytime you need to calculate something in code strip out the complex parts based on the priority levels of (parenthesis, multiplication or division, and lastly plus or minus).
After watching this video, you might wonder how easy mathematics is. Yes, the part of math related with Flash is very simple as it's based on basic mathematical operations. If you need a refresher or you're finding yourself lost, please don't hesitate to contact your assigned trainer, use our community channels or contact us directly.