cps.km 513 B

123456789101112131415161718
  1. do
  2. \ err := catch
  3. \ await { os::println 'Number a:' },
  4. \ str-a := await { os::scanln () },
  5. \ await { os::println 'Number b:' },
  6. \ str-b := await { os::scanln () },
  7. let sum? :=
  8. \ a := get str-a.{parse-float},
  9. \ b := get str-b.{parse-float},
  10. { Some (a + b) },
  11. switch sum?:
  12. case Some sum:
  13. { os::println { String sum } },
  14. case None:
  15. { os::println 'None' },
  16. end,
  17. { crash err };