Javatpoint Logo
Javatpoint Logo

Ruby Comments

Ruby comments are non executable lines in a program. These lines are ignored by the interpreter hence they don't execute while execution of a program. They are written by a programmer to explain their code so that others who look at the code will understand it in a better way.

Types of Ruby comments:

  • Single line comment
  • multi line comment

Ruby Single Line Comment

The Ruby single line comment is used to comment only one line at a time. They are defined with # character.

Syntax:

Example:

Output:

Ruby Comments 1

The Ruby multi line comment is used to comment multiple lines at a time. They are defined with =begin at the starting and =end at the end of the line.

Syntax:

Example:

Output:

Ruby Comments 2






Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA