Commenting Ruby
Ruby has two ways of adding comments to source code, one of which you’ll use, and the other you’ll almost certainly not use. The common one is the # symbol—anything after that symbol until the end of the line is a comment and is ignored by the interpreter. If the next line continues the comment, it needs its own # symbol.
Ruby also has a rarely used multiline comment, where the first line starts with =begin and everything is a comment until the code reaches =end. Both the =begin and =end must be at the very beginning of the line, they cannot be indented.
While we did just say that Ruby ignores comments, Ruby uses a small number of “magic comments” for configuration options on a per-file basis. These comments have the form of ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access