Comments

Commenting code helps programmers write free text that is commonly used to explain the code written, or can even be used to add TO-DOs to the code.

Single-line Comments

Single-line comments start with a #.

# I am a single line comment.

Multi-line comments

Multi-line comments start with =begin and end with =end.

=begin
I am a multi line comment.
I can take as many lines as needed.
=end

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn Ruby on Codecademy

Contributors