Looking at this code I'm having some trouble understanding the if and function and how it works. This might be a simple but I'm just starting out...
(if (and (> b a) (< b (* a b)))
b
a)
I know that in the if statement, the predicate is evaluated and if true, the consequent is evaluated and returns it's value. If it's false, the alternative is evaluated and returns it's value.
In the and statement, the expressions are evaluated left to right, one at a time. If any of the expressions are false, then that and expresson is false and the rest of the expressions are not evaluated. If all of the expressions are true, the value of the and expression is the value of the last one.
I understand these individually, but what happens when both of these are in the same coding. Does the and expression cross out the if since it is written latter?
Any help would be appreciated.
Thanks