# Selection (IF &amp; CASE OF)

> Cambridge Assessment International Education (CAIE) Pseudocode Reference Guide
> Applicable Syllabus: **IGCSE &amp; A Level**

Cambridge pseudocode conditional statements: IF..THEN..ELSE..ENDIF and CASE OF..OTHERWISE..ENDCASE with continuous value ranges.

---

Conditional logic in Cambridge pseudocode uses `IF..THEN..ELSE..ENDIF` or `CASE OF..OTHERWISE..ENDCASE`. CASE values may include discrete constants or continuous value ranges using `TO`.

### IF .. THEN .. ELSE .. ENDIF

```pseudocode
IF ChallengerScore &gt; ChampionScore THEN
   IF ChallengerScore &gt; HighestScore THEN
      OUTPUT ChallengerName, &quot; is champion and highest scorer&quot;
   ELSE
      OUTPUT ChallengerName, &quot; is the new champion&quot;
   ENDIF
ELSE
   OUTPUT ChampionName, &quot; is still the champion&quot;
   IF ChampionScore &gt; HighestScore THEN
      OUTPUT ChampionName, &quot; is also the highest scorer&quot;
   ENDIF
ENDIF
```

### CASE OF .. OTHERWISE .. ENDCASE

```pseudocode
INPUT Move
CASE OF Move
   &#39;W&#39; : Position &lt;- Position - 10
   &#39;S&#39; : Position &lt;- Position + 10
   &#39;A&#39; : Position &lt;- Position - 1
   &#39;D&#39; : Position &lt;- Position + 1
   OTHERWISE : CALL Beep
ENDCASE

// CASE with range values
CASE OF Score
   90 TO 100 : Grade &lt;- &quot;A*&quot;
   80 TO 89  : Grade &lt;- &quot;A&quot;
   70 TO 79  : Grade &lt;- &quot;B&quot;
   OTHERWISE : Grade &lt;- &quot;C or below&quot;
ENDCASE
```


---

* Previous Topic: [Common Operations &amp; Built-in Functions](https://csmasters.dev/docs/pseudocode/operations.md)
* Next Topic: [Iteration (Loops)](https://csmasters.dev/docs/pseudocode/iteration.md)
