Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Code Editor
Learn
Introduction to Ruby

Single-Line Comments

You probably saw us use the # sign a few times in earlier exercises. The # sign is for comments in Ruby. A comment is a bit of text that Ruby won't try to run as code: it's just for humans to read. Writing good comments not only clarifies your code for other people who may read it, but helps remind you of what you were doing when you wrote the code days, months, or even years earlier.

The # sign should come before your comment and affects anything you write after it, so long as you're on a single line. (We'll show you how to do multi-line comments in a second.) Check out these examples:

# I'm a full line comment! "Eric".length # I'm a comment, too!

The second example will return 4, since the comment comes after the code that Ruby will execute.

Report a Bug
If you see a bug or any other issue with this page, please report it here.