Teach "if" statements before "switch" statements, then explain how "switch" is a specialized case of "if" by translating an "if" statement into a "switch" statement.

  • Make sure to pick an "if" statement that can easily be converted to a "switch" statement.
  • A good example that relates directly to the students lives is letter grade to GPA conversion.
    • This can be written with "if" statements such as if (grade == ‘A’).
    • Or, it can be written with a "switch" statement which will be switch(grade) and one case would be case: ‘A’.

More about this tip

External Source

Interview with Dani McAvoy