Comments in Ruby begin with a pound sign (#) outside a string or character constant and proceed to the end of the line:
x = y + 5 # This is a comment.
# This is another comment.
print "# But this isn't."
Embedded documentation is intended to be retrieved from the program text by an external tool. From the point of view of the interpreter, it is like a comment and can be used as such. Given two lines starting with =begin and =end, everything between those lines (inclusive) is ignored by the interpreter. (These can't be preceded by whitespace.)
=begin
The purpose of this program
is to cure cancer
and instigate world peace.
=end
No comments:
Post a Comment