ruby · level 1 · unit 1 · lesson 4
- meet it
- guess first
- your turn
- fix it
- nailed it
Tap a green word if you get lost.
meet it
An is a clue, not a disaster.
An error is Ruby saying it got stuck. Everyone gets them, even experts. The message starts with the kind of error, then tells you which line to look at.
A means Ruby cannot read your code, like a sentence with words missing. Often a quote mark has gone astray.
A means Ruby met a word it does not know, like text with no quotes around it. Capitals matter too: Puts gives a , because Ruby has no command called Puts.
Ruby stops at the first problem it meets, so fix that one and run again.
guess first
One capital letter. What happens?
Guess before you run it. Wrong guesses are how you learn, and nothing is marked.
Puts "Hello!"
your turn
Your turn. Close what you open.
Type your superpower in place of the blank. Then finish the line so the string has a quote mark at both ends, and press run.
fix it
Breakfast is broken. Can you fix it?
- Read the error. Which kind of error is it, and which line?
- It is a NameError on line 2. With no quotes, Ruby thinks Yummy is a word it ought to know.
- Put a quote mark on each side of Yummy, then press run.
nailed it
you turned errors into clues. :D
- Errors are clues. Read the kind of error first.
- A SyntaxError often means a missing quote mark.
- Capitals matter:
putsworks,Putsdoes not.
new words in your collection
- error
- SyntaxError
- NameError
- NoMethodError
This lesson isn’t saved. A free account remembers every lesson you finish.