Add division to examples/03 and add any and all functions for Iter<Bool>

This commit is contained in:
Mark
2023-11-08 15:54:46 +01:00
parent 39fca08541
commit d2fc8c1ebe
2 changed files with 38 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
"- Calculator -".println
"Type =<num> to set the value to that number.".println
"Type +<num>, -<num> or *<num> to change the value.".println
"Type +<num>, -<num>, *<num> or /<num> to change the value.".println
"Type exit to exit.".println
current := 0.0
@@ -19,9 +19,11 @@ current := 0.0
&current = (current, (num, -1).product).sum
} else if mode.eq("*") {
&current = (current, num).product
} else if mode.eq("/") {
&current = (current, num).div
} else if mode.eq("=") {
&current = num
} else if input.eq("exit") {
} else if (input.eq("exit"), input.eq("")).any {
(())
}
})