Changes

Jump to: navigation, search

Commenting Ruby Code

No change in size, 21:06, 30 November 2007
Comments on Lines of Code
== Comments on Lines of Code ==
It is commom common practice to place comments on the same line as the associated code to which the comment applies. For example, if we wanted to place a comment on the same line as our print statement we would do so by placing the comment after a '#' marker: 
<pre>
print "Welcome to Ruby!" # prints the welcome message
</pre>
Note that ''everything'' on the line after the '#' is ignored by the Ruby interpreter. You cannot, therefore, put more code after the '#' and expect it to executed. Additional code must be placed on the next line.
== Multi Line or Block Ruby Comments ==

Navigation menu