Conditional and Looping: switch

Use the switch statement to pass control to a case which matches the result of code block 1. If no case satisfies the condition, the default case is executed.

syntax:

(switch (code block 1)
    (case (number)
        code block 2
    )
    .
    .
    .
    (defualt
        code block 3
    )
)

Example using the switch statement- prints "01.....7....C........" to the screen.
(for (= i 0) (< i 20) (++i)
  (
switch (i)
    (
case 0
      Display("0" dsCOLOR clLIME)
    )

    (case 1
      Display("1" dsCOLOR clBLUE)
    )
    (
case 7
      Display("7" dsCOLOR clYELLOW)
    )
    (
case 12
      Display("C" dsCOLOR clCYAN)
    )
    (
default
      Display("." dsCOLOR clWHITE)
    )
  )
)