0

Consider this paragraph from 'The Elements of Programming':

This uses the special form if, a restricted type of conditional that can be used when there are precisely two cases in the case analysis. The general form of an if expression is

(if ⟨predicate⟩ ⟨consequent⟩ ⟨alternative⟩)

To evaluate an if expression, the interpreter starts by evaluating the ⟨predicate⟩ part of the expression. If the ⟨predicate⟩ evaluates to a true value, the interpreter then evaluates the ⟨consequent⟩ and returns its value. Otherwise it evaluates the ⟨alternative⟩ and returns its value.

I understand that "precisely" means "exactly". But I got confused when it is asociated with the phrase "can be used".

What does the phrase "can be used when there are precisely two cases" mean exactly? Could it be:

  • I can only use this conditional only if I have two cases, nothing less?
  • I can use this conditional if I have two cases, but I can still use it even though I only have one case?
  • The text does not say that the conditional can be used when there is other than precisely/exactly two cases. You need to read what the text says, not what it doesn't say. – AmE speaker Jul 30 '18 at 15:22
2

I can only use this conditional only if I have two cases, nothing less?

This is correct. The condition can be used if there are precisely two cases, implying that the condition cannot be used in any other situation.

  • 1
    The two cases are "true" and "false". So, if there were only one case, then it wouldn't be conditional! – user184130 Jul 30 '18 at 15:21
  • @JamesRandom and more than two cases would require else/if statements. – Patrick Jul 30 '18 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.