Previous | Next

Lisp conditionals


(if (= imageType GRAY)
    (do-greyscale-stuff)   ;; if grayscale
    (do-color-stuff)       ;; else
)

When you're programming in lisp, everything is a list, surrounded by parentheses. Even conditionals.

So you have a list that starts with if; then you have the condition; then the if clause, then the else clause.

Everything uses prefix notation, so instead of asking if imagetype equals grey, you say if equals imagetype grey.