Ruby comment
Comments are comment lines within Ruby code that are ignored at run time. A single-line comment begins with the # character and ends with the line, as follows:
Example
#!/usr/bin/ruby -w#This is a single line comment.puts"Hello, Ruby!"
When executed, the above program produces the following results:
Hello, Ruby!
Ruby multiline comment
You can use the =begin
and =end
the syntax comment is multiline, as follows:
Example
#/ Usr/bin/ruby wputs "Hello, Ruby!"=begin This is a multi line comment.
Expandable to any number of rows. But=begin and=end
Can only appear on the first and last lines= End
When executed, the above program produces the following results:
Hello, Ruby!
Make sure that the trailing comments are sufficiently distant from the code to make it easy to distinguish between comments and code. If the tail has more than one comment, align them. For example:
Example
@counter#Track the number of clicks on a
page@siteCounter#Track the number of clicks on all pages