July 2011
Intermediate to advanced
400 pages
8h 46m
English
In The Book of Ruby, Ruby source code is written like this:
def saysomething
puts( "Hello" )
endOften the code will be annotated with comments. Ruby comments are any text following a hash mark (#) on a single line. The comments are ignored by the Ruby interpreter. When I want to draw attention to some output that Ruby displays or to a value returned by a piece of code (even if that value is not displayed), I indicate this with this type of comment: # =>. Occasionally, when I want to draw attention to some input that the user should enter, I use this type of comment: # <=. Here is an example to illustrate these commenting conventions:
puts("Enter a calculation:" ) # Prompt user this is a simple comment exp = gets().chomp() ...Read now
Unlock full access