Revise Computingrevisecomputing.co.uk
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates

Knowledge organisers / Selection

ELIF chains

All topicsPractise exam questions
Knowledge organiser

Selection

301.9b

Multi-branch decision making.

What you need to know

elif (else if) lets you check multiple conditions in sequence. Python checks each one top-to-bottom and runs the first branch that is True, then skips the rest.

Key points

  • elif adds extra conditions after if
  • Checked top-to-bottom — first True wins
  • else at the end catches everything not matched
  • Order matters — put the most specific condition first

Code examples

ELIF chain
python
score = int(input("Score: "))
if score >= 90:
    print("A")
elif score >= 70:
    print("B")
elif score >= 50:
    print("C")
else:
    print("Fail")