Post-statement blocks

Macros can receive of, elif, else, except, finally and do blocks (including their different forms such as do with routine parameters) as arguments if called in statement form.

  1. macro performWithUndo(task, undo: untyped) = ...
  2. performWithUndo do:
  3. # multiple-line block of code
  4. # to perform the task
  5. do:
  6. # code to undo it
  7. let num = 12
  8. # a single colon may be used if there is no initial block
  9. match (num mod 3, num mod 5):
  10. of (0, 0):
  11. echo "FizzBuzz"
  12. of (0, _):
  13. echo "Fizz"
  14. of (_, 0):
  15. echo "Buzz"
  16. else:
  17. echo num