Learn Ruby
Variables
5.6
Lesson

Comment

Ruby ignores everyting that comes after a #. Programmers call it a comment. Comments are for humans and not for computers. Computers skips all the comments and do not even look at them.

Ruby will ignore the first line because it is a comment.

A comment can start mid way too.

In the above case Ruby will process the statement until it sees a # and then it will ignore the rest of the line.

Note that if a # appears inside a string then Ruby will not ignore it.

In the above case # is inside a string so Ruby will not treat it as a comment.