Comments

Comments are lines of annotation within Ruby code that are ignored at runtime. Comments extend from # to the end of the line.

# This is a comment.

Ruby code can contain embedded documents too. Embedded documents extend from a line beginning with =begin to the next line beginning with =end. =begin and =end must come at the beginning of a line.

=begin
This is an embedded document.
=end

Get Ruby in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.