Skip to content
Course briefing · 20 min

Debug a broken script

Fix type and naming errors, then verify the intended behavior.

1

Read the first diagnostic

The starter has two defects: an int initialized with text and a variable reference with different capitalization. Run it before editing. Fix the first reported error, then run again to expose the next one.

2

Keep the intended behavior in sight

The desired outcome is health 200 and one notification saying Fixed and running. Removing all the code may remove diagnostics, but it does not repair the behavior. The lab checks the outcome as well as the run status.

3

Use trace output thoughtfully

Console.WriteLine("checking health"); adds a trace line without changing the game preview. In real development, use logs to observe the path your program took. Keep reproducible steps and small changes as you debug.

Microsoft: C# type checking

Explore as a guest. Your current lab resumes in this browser session. Sign in before learning to save course completions to your account.

Sign in to save progress →