SlideShare a Scribd company logo
RUBY COMMENTS
http://www.tutorialspoint.com/ruby/ruby_comments.htm                                           Copyright © tutorialspoint.com



Comments are lines of annotation within Ruby code that are ignored at runtime. A single line comment starts with #
charcter and they extend from # to the end of the line as follows:

 #!/usr/bin/ruby -w

 # This is a single line comment.

 puts "Hello, Ruby!"


Ruby Multiline Comments

You can comment multiple lines using =begin and =end syntax as follows:

 #!/usr/bin/ruby -w

 puts "Hello, Ruby!"

 =begin
 This is a multiline comment and con spwan as many lines as you
 like. But =begin and =end should come in the first line only.
 =end


Make sure trailing comments are far enough from the code that it is easily distinguished. If more than one trailing
comment exists in a block, align them. For example:

 @counter           # keeps track times page has been hit
 @siteCounter       # keeps track of times all pages have been hit

More Related Content

PDF
BI is Yours
PDF
Franciin turiin togtoltsoo
PDF
Las Instituciones familiares y procedimientos y aspectos legales
DOCX
Uso de diferentes Recursos Educativos Digitales
PDF
PPTX
Mision y vision
PDF
Wonen met gemak, echt een uitkomst!
PDF
WritingCenterBookmarks4_proof
BI is Yours
Franciin turiin togtoltsoo
Las Instituciones familiares y procedimientos y aspectos legales
Uso de diferentes Recursos Educativos Digitales
Mision y vision
Wonen met gemak, echt een uitkomst!
WritingCenterBookmarks4_proof

Similar to 08 ruby comments (20)

PPTX
KEY
Rails console
PDF
04 ruby syntax
PPTX
Ruby basics
PDF
Ruby training day1
PPTX
Ruby -the wheel Technology
PDF
Ruby_Coding_Convention
DOCX
Page List & Sample Material (Repaired)
PDF
Ruby_Basic
PPTX
Ruby from zero to hero
PPT
Ruby Chapter 2
PDF
Ruby Presentation - Article
PDF
00 ruby tutorial
PDF
20 ruby input output
PDF
Ruby Presentation
PPT
Learn Ruby Programming in Amc Square Learning
PPT
Ruby programming introduction
PDF
06 ruby variables
PPT
WorkinOnTheRailsRoad
Rails console
04 ruby syntax
Ruby basics
Ruby training day1
Ruby -the wheel Technology
Ruby_Coding_Convention
Page List & Sample Material (Repaired)
Ruby_Basic
Ruby from zero to hero
Ruby Chapter 2
Ruby Presentation - Article
00 ruby tutorial
20 ruby input output
Ruby Presentation
Learn Ruby Programming in Amc Square Learning
Ruby programming introduction
06 ruby variables
WorkinOnTheRailsRoad
Ad

More from Walker Maidana (18)

PDF
19 ruby iterators
PDF
18 ruby ranges
PDF
17 ruby date time
PDF
16 ruby hashes
PDF
15 ruby arrays
PDF
14 ruby strings
PDF
13 ruby modules
PDF
12 ruby blocks
PDF
11 ruby methods
PDF
10 ruby loops
PDF
09 ruby if else
PDF
07 ruby operators
PDF
05 ruby classes
PDF
03 ruby environment
PDF
01 index
PDF
02 ruby overview
PDF
21 ruby exceptions
PDF
Tutorial ruby eustaquio taq rangel
19 ruby iterators
18 ruby ranges
17 ruby date time
16 ruby hashes
15 ruby arrays
14 ruby strings
13 ruby modules
12 ruby blocks
11 ruby methods
10 ruby loops
09 ruby if else
07 ruby operators
05 ruby classes
03 ruby environment
01 index
02 ruby overview
21 ruby exceptions
Tutorial ruby eustaquio taq rangel
Ad

08 ruby comments

  • 1. RUBY COMMENTS http://www.tutorialspoint.com/ruby/ruby_comments.htm Copyright © tutorialspoint.com Comments are lines of annotation within Ruby code that are ignored at runtime. A single line comment starts with # charcter and they extend from # to the end of the line as follows: #!/usr/bin/ruby -w # This is a single line comment. puts "Hello, Ruby!" Ruby Multiline Comments You can comment multiple lines using =begin and =end syntax as follows: #!/usr/bin/ruby -w puts "Hello, Ruby!" =begin This is a multiline comment and con spwan as many lines as you like. But =begin and =end should come in the first line only. =end Make sure trailing comments are far enough from the code that it is easily distinguished. If more than one trailing comment exists in a block, align them. For example: @counter # keeps track times page has been hit @siteCounter # keeps track of times all pages have been hit