About 'Using if, else if & else'!

cud_s02_using_if_else_if__else

#1

In this video (objectives)…

  1. Consider the problem we have of multiple key presses being possible.
  2. Discuss the difference between if, else if & else conditional statements.
  3. Implement an approach that makes our key presses mutually exclusive of one another.

After watching (learning outcomes)… Use if and else if statements to make key presses mutually exclusive.

(Unique Video Reference: 5_NC_CUD)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!


#2

Hey Rick.
With the else if statements, I understand that it’s only allowing 1 key to be registered at a time. However, I don’t quite understand why that happens.
Else if, as you’ve said is like saying “execute this statement if true, otherwise, execute this instead etc etc”. I can’t quite make that mental leap that makes every key press exclusive from one another.
I hope that makes sense. I always get stuck with programming (which I desperately want to be great at), perhaps through overthinking.

Great lectures so far, I just like everything to be clear.
Cheers,
Max.