this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Simplecalculator now uses match

22widi 4e76f034 c9a8482f

+16 -14
+16 -14
examples/SimpleCalculator.as
··· 2 2 val2: float = float(to: input(message: "val2: ")); 3 3 op: int = int(to: input(message: "op (plus: 0, minus: 1, multiply: 2, divide: 3): ")); 4 4 5 - if op == 0 6 - { 7 - print(message: val1 + val2); 8 - } 9 - if op == 1 5 + match op 10 6 { 11 - print(message: val1 - val2); 12 - } 13 - if op == 2 14 - { 15 - print(message: val1 * val2); 16 - } 17 - if op == 3 18 - { 19 - print(message: val1 / val2); 7 + 0: { 8 + print(message: val1 + val2); 9 + } 10 + 1: { 11 + print(message: val1 - val2); 12 + } 13 + 2: { 14 + print(message: val1 * val2); 15 + } 16 + 3: { 17 + print(message: val1 / val2); 18 + } 19 + _: { 20 + print(message: "Invalid operator!"); 21 + } 20 22 }