top of page

Commenting Ruby Code

Single Line Ruby Comments

# This is a comment line
print "Welcome to Ruby!"

The '#' character is used for Single line comments in a Ruby script.



Comments on Lines of Code

print "Welcome to Ruby!"     # prints the welcome message


Multi Line or Block Ruby Comment

=begin
This is a comment line
it explains that the next line of code displays 
a welcome message
=end

=begin and =end comment markers is used to defined as comments in ruby. These are known as the comment block markers


Any suggestion and correction is acceptable please do if you have any.
11 views0 comments

Recent Posts

See All
bottom of page