Python · Lesson 3.4 · Pro

One-line ifs and match

Pick between two values in one line, and choose between many cases with match.

In this lesson

  1. A value-picking if
  2. Clamping a value
  3. match: many exact cases
  4. Choosing the right tool