Scheme Exercises

back to exercise list       previous     next

Group:     Exercise: 48/48 

Is between?:  Is the first number between the second and third?

Create the function "is-between" which will be given 3 numbers, let's say: first, second and third. The function will return #t if the first number is STRICTLY between the second and third. If the first is not between the second and third, return #f. Also return #f is the first is equal to the second or the third (or both). Examples:
(is-between 3 1 8) -> #t
(is-between 3 8 1) -> #t
(is-between 3 1 3) -> #f
(is-between 18 2 5) -> #f