Solution Review 2: Make a Calculator
This lesson gives a detailed solution review to the challenge in the previous lesson.
We'll cover the following...
We'll cover the following...
Solution :
Explanation
-
matchconstructA
matchconstruct is defined from line 2 to line 19.- On line 2, the
matchstatement takes anoperatorvariable.- On line 3, checks if the operator variable is equal to
+then it displays the result of addition on line 4. - On line 6, checks if the operator variable is equal to
-then it displays the result of subtraction on
- On line 3, checks if the operator variable is equal to
- On line 2, the