SlideShare ist ein Scribd-Unternehmen logo
1 von 1
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Ähnlich wie 08 ruby comments

Ruby Basics
Ruby BasicsRuby Basics
Ruby BasicsSHC
 
Ruby Presentation
Ruby Presentation Ruby Presentation
Ruby Presentation platico_dev
 
Ruby_Coding_Convention
Ruby_Coding_ConventionRuby_Coding_Convention
Ruby_Coding_ConventionJesse Cai
 
Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)Muhammad Haseeb Shahid
 
introduction to server-side scripting
introduction to server-side scriptingintroduction to server-side scripting
introduction to server-side scriptingAmirul Shafeeq
 
Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Henry S
 
Part 2 in depth guide on word-press coding standards for css & js big
Part 2  in depth guide on word-press coding standards for css & js bigPart 2  in depth guide on word-press coding standards for css & js big
Part 2 in depth guide on word-press coding standards for css & js bigeSparkBiz
 

Ähnlich wie 08 ruby comments (16)

04 ruby syntax
04 ruby syntax04 ruby syntax
04 ruby syntax
 
Ruby Basics
Ruby BasicsRuby Basics
Ruby Basics
 
Ruby
RubyRuby
Ruby
 
Ruby Presentation
Ruby Presentation Ruby Presentation
Ruby Presentation
 
Ruby_Coding_Convention
Ruby_Coding_ConventionRuby_Coding_Convention
Ruby_Coding_Convention
 
Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)
 
Ruby
RubyRuby
Ruby
 
Js syntax
Js syntaxJs syntax
Js syntax
 
Ruby in mule
Ruby in muleRuby in mule
Ruby in mule
 
introduction to server-side scripting
introduction to server-side scriptingintroduction to server-side scripting
introduction to server-side scripting
 
01 index
01 index01 index
01 index
 
Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1
 
Ruby
RubyRuby
Ruby
 
Ruby Beyond Rails
Ruby Beyond RailsRuby Beyond Rails
Ruby Beyond Rails
 
Part 2 in depth guide on word-press coding standards for css & js big
Part 2  in depth guide on word-press coding standards for css & js bigPart 2  in depth guide on word-press coding standards for css & js big
Part 2 in depth guide on word-press coding standards for css & js big
 
10 ruby loops
10 ruby loops10 ruby loops
10 ruby loops
 

Mehr von Walker Maidana (19)

20 ruby input output
20 ruby input output20 ruby input output
20 ruby input output
 
19 ruby iterators
19 ruby iterators19 ruby iterators
19 ruby iterators
 
18 ruby ranges
18 ruby ranges18 ruby ranges
18 ruby ranges
 
17 ruby date time
17 ruby date time17 ruby date time
17 ruby date time
 
16 ruby hashes
16 ruby hashes16 ruby hashes
16 ruby hashes
 
15 ruby arrays
15 ruby arrays15 ruby arrays
15 ruby arrays
 
14 ruby strings
14 ruby strings14 ruby strings
14 ruby strings
 
13 ruby modules
13 ruby modules13 ruby modules
13 ruby modules
 
12 ruby blocks
12 ruby blocks12 ruby blocks
12 ruby blocks
 
11 ruby methods
11 ruby methods11 ruby methods
11 ruby methods
 
09 ruby if else
09 ruby if else09 ruby if else
09 ruby if else
 
07 ruby operators
07 ruby operators07 ruby operators
07 ruby operators
 
06 ruby variables
06 ruby variables06 ruby variables
06 ruby variables
 
05 ruby classes
05 ruby classes05 ruby classes
05 ruby classes
 
03 ruby environment
03 ruby environment03 ruby environment
03 ruby environment
 
00 ruby tutorial
00 ruby tutorial00 ruby tutorial
00 ruby tutorial
 
02 ruby overview
02 ruby overview02 ruby overview
02 ruby overview
 
21 ruby exceptions
21 ruby exceptions21 ruby exceptions
21 ruby exceptions
 
Tutorial ruby eustaquio taq rangel
Tutorial ruby   eustaquio taq rangelTutorial ruby   eustaquio taq rangel
Tutorial ruby eustaquio taq rangel
 

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