How can I comment multiple lines in Ruby?
Multi-Line Comments A multi-line comment begins with the =begin token and ends with the =end token. These tokens should start at the beginning of the line and be the only thing on the line. Anything between these two tokens is ignored by the Ruby interpreter. lines are ignored by the Ruby interpreter.
To comment out multiple code lines right-click and select Source > Add Block Comment. ( CTRL+SHIFT+/ )
#!/usr/bin/env ruby =begin Every body mentioned this way to have multiline comments. The =begin and =end must be at the beginning of the line or it will be a syntax error. =end puts "Hello world!" <<-DOC Also, you could create a docstring. which... DOC puts "Hello world!" "..is kinda ugly and creates a String instance, but I know one guy with a Smalltalk background, who does this." puts "Hello world!" ## # most # people # do # this __END__ But all forgot there is another option. Only at the end of a file, of course.
=begin My multiline comment here =end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With