Revise Computing
Revision notesQuestionsFor schools
Log inStart revising free
Revision notesQuestionsFor schoolsLog in
GCSE Computer Science/Supplementary programming practice/Selection

Match Case

301.9 Selection

Practise exam questions

Selection — Note 4 of 4

Match Case statements

What you need to know

Python 3.10 introduced match-case (structural pattern matching). It compares a value against multiple patterns, similar to a switch statement in other languages.

What to know

  • match value: starts the block
  • case pattern: checks if value matches
  • case _: is the default (wildcard) case
  • Cleaner than long elif chains for simple value matching
  • Available from Python 3.10 onwards

Code examples

Match Case
python
command = input("Enter command: ")
match command:
    case "start":
        print("Starting...")
    case "stop":
        print("Stopping...")
    case _:
        print("Unknown command")
← Previous noteNested IF301.9 SelectionNext topic →FOR loops301.10 Iteration

Back to Selection

Specification notes for programming are in Paper 2.

Selection

Note 4 of 4

  1. 1IF and Else
  2. 2ELIF chains
  3. 3Nested IF
  4. 4Match Case
Topic overview

© 2026 Revise Computing · revisecomputing.co.uk

Privacy noticeTermsContact

Revise Computing is an independent revision resource. It is not affiliated with, or endorsed by, OCR (Oxford Cambridge and RSA Examinations).