allow for one-line if and else bodies without {}

This commit is contained in:
r4
2021-12-26 19:18:52 +01:00
parent 46e7487cad
commit cda56d5b9c
3 changed files with 25 additions and 13 deletions

View File

@@ -10,13 +10,12 @@ if (!(op == "+" || op == "-" || op == "*" || op == "/")) {
n2 := float(getln())
put("Result: ")
if (op == "+") {
if (op == "+")
putln(n1 + n2)
} else if (op == "-") {
else if (op == "-")
putln(n1 - n2)
} else if (op == "*") {
else if (op == "*")
putln(n1 * n2)
} else if (op == "/") {
else if (op == "/")
putln(n1 / n2)
}
}