Two forward slashes (//) begin single-line comments. The compiler ignores any content between // and the end of the line (will not be executed).
// is really a single-line comment. From the // through the end of the line, everything is a comment. Use /* to start a comment and */ to finish a comment to mark a whole region as a comment. * This is an example of a block comment.
Any sequence of characters after the //(two slashes) characters. This type of comment is terminated by a new line that is not immediately preceded by a backslash. As a result, it's known as a "single-line comment."
Single line comments in Ruby are used to document code and provide instructions or explanations.
Share a personalized message with your friends.