Home›Lesson Plans›Computer Science›Programming · Grade 9

Syntax vs Logic Errors

Ninth graders learn the two main kinds of bugs — syntax errors (the code breaks the language’s rules and won’t run) and logic errors (the code runs but does the wrong thing). Knowing which is which makes debugging faster. They sort the errors, then find both.

Grade 9Syntax vs Logic Errors55 minutes1 class periodCSTA / ISTEExplicit teaching4 StandardsCSTA
Start the Lesson
Assign or share this lesson

Copy link works with Canvas, Schoology, Moodle and any other LMS — paste it in as a resource or assignment.

Lesson at a Glance

Everything you need before the bell rings

Learning Objectives

Students will be able to…

  • ✓Define syntax errors.
  • ✓Define logic errors.
  • ✓Tell them apart.
  • ✓Debug faster.
Essential Question

Why does some broken code refuse to run, while other broken code runs but is wrong?

0
Lesson Phases
0
Vocabulary Terms
0
Standards Aligned
0
Interactive Task
Sort It · Interactive

Syntax, or Logic Error?

Project this and sort each into Syntax error or Logic error.

🐛 Sort each — syntax error, or logic error?Try it
⚠️ Syntax error
🧠 Logic error
Tap one, then tap a box.
The Lesson · Explicit teaching

55 minutes, five moves

Tap any phase to open the teacher moves and student actions.

1

Hook — Two Kinds of Bugs

6 min

One program won’t run; another runs but gives a wrong answer. Why?

👩‍🏫 Teacher Moves

  • Pose the question.
  • Share ideas.
  • Set the goal.

🎒 Student Actions

  • Think.
  • Share.
  • Get ready.
2

Use — Error Types

13 min

Students learn.

👩‍🏫 Teacher Moves

  • Send students to Syntax or Logic Error?
  • Sort each one.
  • Note syntax stops it running.

🎒 Student Actions

  • Sort.
  • Say.
  • Note it.
3

Modify — Spot It

14 min

Students practice.

👩‍🏫 Teacher Moves

  • Find a syntax error.
  • Find a logic error.
  • Say how you’d fix each.

🎒 Student Actions

  • Syntax.
  • Logic.
  • Fix.
4

Create — Create

15 min

Students apply.

👩‍🏫 Teacher Moves

  • Debug a syntax error.
  • Debug a logic error.
  • Re-test.

🎒 Student Actions

  • Fix.
  • Fix.
  • Test.
5

Reflect — Reflect

7 min

Students close.

👩‍🏫 Teacher Moves

  • What is a syntax error?
  • What is a logic error?
  • Complete the exit ticket.

🎒 Student Actions

  • Say it.
  • Say it.
  • Complete the exit ticket.
Standards Alignment

Built to the standards you report on

Aligned to the CSTA K-12 Computer Science Standards and the ISTE Standards for Students.

CSTA
3A-AP-17

Identify and fix syntax and logic errors.

CSTA
3A-AP-21

Evaluate program correctness.

CSTA
3A-AP-23

Document debugging.

ISTE
5c

Troubleshoot systematically.

Differentiation

One lesson, every learner

Multilingual Learners

ELL / EMERGING READERS
  • Error-type cards.
  • Frame: "a syntax error ___."
  • Use code examples.

Support & Access

IEP / 504
  • Sort syntax vs logic.
  • Use 4 errors.
  • Use examples.

Stretch & Extend

GIFTED / EARLY FINISHERS
  • Fix a mixed set of bugs.
  • Read error messages.
  • Add test cases.
Materials

What to gather

  • 🐛Error cards
  • 📽️Screen / board
  • 💻Syntax or Logic Error?
  • 💻Python
  • 📓Notebooks
  • 🎫Exit-ticket slips
Vocabulary

Key terms — hover for a quick definition

syntax errorbreaks the language’s ruleslogic errorruns but is wrongbugan error in codedebugfind and fix errorskeyworda reserved wordindentationspacing that matters in Pythonruntimewhile the program runsoutputwhat the program produces
Evaluate

Exit Ticket

Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students.

QUESTION 1
What is a syntax error?
Code that breaks the language’s rules and won’t run.
QUESTION 2
What is a logic error?
Code that runs but gives the wrong result.
QUESTION 3
Which stops the program from running?
A syntax error.

Reflect: syntax vs logic errors.

Have students find and fix one syntax and one logic error. A printable error sheet is in the CS library.

Study · Flashcards

Study the key terms

Tap a card to flip it, then rate whether you knew it. Built from this lesson’s vocabulary.

🃏 Syntax vs Logic ErrorsFlip
Card 1
Term
Tap to flip →
Meaning
0

Nice work!

Practice · Quiz

Check your understanding

A quick self-check with instant feedback, drawn from this lesson’s key terms.

📝 Syntax vs Logic ErrorsQuiz
Score: 0
1 / 6
Question 1
0%

Nice work!

Practice · Worksheet

Printable worksheet

A print-and-go review sheet with a built-in answer key. Tap “Show answer key” to reveal answers, or print the clean version for students.

🖨️ Syntax vs Logic ErrorsPrint
Name: ________________________
Date: ____________

Part A · Write the word that matches each meaning

Word bank: bug, debug, indentation, keyword, logic error, output, runtime, syntax error
  1. an error in code
  2. spacing that matters in Python
  3. breaks the language’s rules
  4. runs but is wrong
  5. find and fix errors
  6. a reserved word
  7. what the program produces
  8. while the program runs

Part B · Show what you learned

  1. What is a syntax error?
  2. What is a logic error?
  3. Which stops the program from running?
Answer key — Part A: 1) bug · 2) indentation · 3) syntax error · 4) logic error · 5) debug · 6) keyword · 7) output · 8) runtime
Part B: 1) Code that breaks the language’s rules and won’t run. 2) Code that runs but gives the wrong result. 3) A syntax error.