19 lines
478 B
HTML
19 lines
478 B
HTML
#! /usr/bin/gcl -f
|
|
|
|
; examples using case for testing value of an item
|
|
|
|
; initialize a variable x (just for the sake of the example)
|
|
(defvar x 3)
|
|
|
|
; case acts much like a C switch statement
|
|
(case x
|
|
(0 (format t "x is 0~%"))
|
|
(1 (format t "x is 1~%"))
|
|
(2 (format t "x is 2~%"))
|
|
("hi" (format t "x is string hi~%"))
|
|
('(2 4 6) (format t "x is list (2 4 6)~%"))
|
|
(3 (format t "x is 3~%"))
|
|
(otherwise (format t "x is something else~%"))
|
|
)
|
|
|
|
|