Ruby Comment
Comments are ignored at runtime Ruby code within the comment line. Single-line comments begin with the # character, until the end of the line as follows:
Examples
#! / Usr / bin / ruby -w
# This is a single line comment.
puts "Hello, Ruby!"
# This is a single line comment.
puts "Hello, Ruby!"
Running instance »
When executed, the above program will produce the following results:
Hello, Ruby!
Ruby multi-line comments
You can use the syntax= begin and = endcomment multiple lines, as follows:
#! / Usr / bin / ruby -w puts "Hello, Ruby!" = Begin This is a multi-line comment. Expandable to any number of rows. = Begin and = end but only appear on the first and last rows. = End
When executed, the above program will produce the following results:
Hello, Ruby!
Make sure the back end of the comment from the code a sufficient distance so easy to distinguish between comments and code. If more than one trailing comment, please align them. E.g:
@counter # tracking page is clicked @siteCounter # tracks all pages are clicked