FANDOM


Comments are commonly used in scripts in order to add further information and structure.

In the Script Editor, comments are indicated in green.

There are two different ways to write comments:


def helloworld
  #prints "Hello World!"
  p "Hello World!"
end


If you write #, everything written in the same line but behind the sign will be considered as commentary. Therefore, this works as well:


p "Hello World!" #prints "Hello World!"


However, comments using # only work for a single line each.

If you want more lines to be considered as commentary, you'll have to use this method:


=begin
  this is a comment
  since this is between "begin" and "end",
  this is considered to be a comment, even though it's longer than one line.
  begin and end have to be at the very beginning of their
  lines, otherwise it will not work.
=end