mers/examples/02_Calc_Sum.mers
2023-10-19 19:38:13 +02:00

14 lines
293 B
Plaintext

total := 0.0
{() -> {
("Total: ", total, ". Type a number to change.").concat.println
(
().read_line.trim.parse_float,
(
n -> &total = (total, n).sum,
// not a number, so return a 1-tuple to break from the loop
() -> (())
)
).try
}}.loop
"Goodbye.".println