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 racket
 
;; define a new exception type
(struct exn:my-exception exn ())
 
;; handler that prints the message ("Hi!")
(define (handler exn)
  (displayln (exn-message exn)))
 
;; install exception handlers
(with-handlers ([exn:my-exception? handler])
  ;; raise the exception
  (raise (exn:my-exception "Hi!" (current-continuation-marks))))
 