; CONDITIONAL EVALUATION (IF and COND) ; synatax of IF ; (if TEST TRUE-EXP FALSE-EXP) ; what this tells the Dr. Scheme is "if the TEST is true then return the TRUE-EXP, ; otherwise return the FALSE-EXP" ; example: (if (even? 6) "six is even" "the computer is broken") ; note that the TEST is almost always in partenthesis because it is a call to a boolean ; procedure (define is-input-even (lambda (x) (if (even? x) "x is even" "x is not even"))) ; COND syntax: ; (cond ; (TEST1 RESULT1) ; (TEST2 RESULT2) ; .... ; (else ELSE-RESULT)) ; this will return the first result corresponding to a true test ; not again that tests will usuaully be boolean expressions (define larger (lambda (a b) (cond ((> a b) "a is larger") ((> b a) "b is larger") (else "a and b are equal"))))