Example
my_if test then_val else_val =
if test then then_val else else_val
my_if True 3 4
3 : Int
my_if False 3 4
4 : Int
x = 3
y = 12
my_if (x /= 0) (y `div` x) (-1)
4 : Int
Different than in Scheme and ML, which would require a special form
Previous slide
Next slide
Back to first slide
View graphic version