Conditionals

 [Previous Chapter]  [Previous Page]  [Contents]  [Next Page]  [Next Chapter]

GreetingByHour1.scm
(define Greeting
   (lambda (hour24)
      (if (< hour24 12)
         "Good Morning"
         (if (< hour24 18)
            "Good Afternoon"
            "Good Evening"
         )
      )
   )
)

*An if operator is available:

<expression> ---> (if <test> <consequent> <alternate> )
<expression> ---> (if <test> <consequent> )
<test> ---> <expression> <consequent> ---> <expression> <alternate> ---> <expression>
 

*Note that everything what is not equivalent to #f is considered as true in tests including the empty list in R5S5 conforming implementations. This behavior also diverts from many other Lisp dialects.
 

 [Previous Chapter]  [Previous Page]  [Contents]  [Next Page]  [Next Chapter]
Copyright © 2002 Andreas Borchert, converted to HTML on May 02, 2002