# 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… **Computer Science** | **Grade 9** *A free lesson plan from K12 Academics. Source page: https://lessonplans.k12academics.com/k12-lesson-g9-cs-error-types.html* 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. **Copy link** works with Canvas, Schoology, Moodle and any other LMS — paste it in as a resource or assignment. ## 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. Why does some broken code refuse to run, while other broken code runs but is wrong? ## Syntax, or Logic Error? Project this and sort each into Syntax error or Logic error. ## 55 minutes, five moves Tap any phase to open the teacher moves and student actions. ### Hook — Two Kinds of Bugs 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. ### Use — Error Types 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. ### Modify — Spot It Students practice. #### 👩‍🏫 Teacher Moves - Find a syntax error. - Find a logic error. - Say how you’d fix each. #### 🎒 Student Actions - Syntax. - Logic. - Fix. ### Create — Create Students apply. #### 👩‍🏫 Teacher Moves - Debug a syntax error. - Debug a logic error. - Re-test. #### 🎒 Student Actions - Fix. - Fix. - Test. ### Reflect — Reflect 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. ## Built to the standards you report on Aligned to the CSTA K-12 Computer Science Standards and the ISTE Standards for Students. Identify and fix syntax and logic errors. Evaluate program correctness. Document debugging. Troubleshoot systematically. ## One lesson, every learner ### Multilingual Learners - Error-type cards. - Frame: "a syntax error ___." - Use code examples. ### Support & Access - Sort syntax vs logic. - Use 4 errors. - Use examples. ### Stretch & Extend - Fix a mixed set of bugs. - Read error messages. - Add test cases. ### What to gather - 🐛Error cards - 📽️Screen / board - 💻Syntax or Logic Error? - 💻Python - 📓Notebooks - 🎫Exit-ticket slips ### Key terms - **syntax error**: breaks the language’s rules - **logic error**: runs but is wrong - **bug**: an error in code - **debug**: find and fix errors - **keyword**: a reserved word - **indentation**: spacing that matters in Python - **runtime**: while the program runs - **output**: what the program produces ## Exit Ticket Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students. ### 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. ## Check your understanding **1. What does “syntax error” mean?** - breaks the language’s rules *(correct)* - spacing that matters in Python - what the program produces - while the program runs “syntax error” means: breaks the language’s rules **2. Which word means: “runs but is wrong”?** - indentation - debug - logic error *(correct)* - keyword “logic error” means: runs but is wrong **3. What does “bug” mean?** - find and fix errors - a reserved word - an error in code *(correct)* - runs but is wrong “bug” means: an error in code **4. Which word means: “find and fix errors”?** - keyword - bug - debug *(correct)* - runtime “debug” means: find and fix errors **5. What does “keyword” mean?** - runs but is wrong - a reserved word *(correct)* - an error in code - while the program runs “keyword” means: a reserved word **6. Which word means: “spacing that matters in Python”?** - keyword - logic error - indentation *(correct)* - bug “indentation” means: spacing that matters in Python ## Printable worksheet --- Full lesson page: https://lessonplans.k12academics.com/k12-lesson-g9-cs-error-types.html All lessons: https://lessonplans.k12academics.com/