Control Structures
These are examples of control structures. You may also be interested in:

 Conditional structures
 Exceptions
 Flow-control structures
 Loops

This task is to give an example of an exception handling routine
and to "throw" a new exception.



Related task

   Exceptions Through Nested Calls


#lang transd
 
mainModule : {
  func2: (lambda i Int() 
    (if (!= i 13) 
      (textout "OK " i "\n") 
      (throw "fail\n"))),
 
  func1: (lambda 
    (textout "before try\n")
    (try 
      (textout "before while\n")
      (with n 10
        (while (< n 15) (+= n 1)
          (func2 n)
        )
      )
      (textout "after while\n")
      (catch (report e))
    )
    (textout "after try\n")
  ),
  _start: (lambda (func1))
}
 