|
|
An example of type checking |
Is the expression (+ 1 (if (even? x) 5 "five")) correct with respect to types? | The example shows an arithmetic expression that will cause a type error with most type checkers.
However, if x is even the sum can be evaluated to 6. If x is odd, we encounter a type error because we cannot
add the integer 1 to the string "five". |
|
|
|