Ruby: Comments

In Ruby we can add comments to our code in two ways

  1. Single line comments
  2. Multi-line comments

For single line comments, we use # before the comment to be added.

For eg: #this is a comment

For multi-line comment; we use =begin at the start and =end at the end.

For eg:

=begin

I want to add

multi line

comment

=end

Note: There should be no space between = and begin/end

Leave a Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s