#!/usr/bin/env ruby
=beginBetween =begin and =end, any numberof lines may be written. All of theselines are ignored by the Ruby interpreter.=end
puts "Hello world!"
#!/usr/bin/env ruby
=beginEvery body mentioned this wayto have multiline comments.
The =begin and =end must be at the beginning of the line orit will be a syntax error.=end
puts "Hello world!"
<<-DOCAlso, you could create a docstring.which...DOC
puts "Hello world!"
"..is kinda ugly and createsa String instance, but I know one guywith a Smalltalk background, whodoes 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.
def idle<<~aidThis is some description of what idle does.
It does nothing actually, it's just here to show an example of multilinedocumentation. Thus said, this is something that is more common in thepython community. That's an important point as it's good to also fit theexpectation of your community of work. Now, if you agree with your team togo with a solution like this one for documenting your own base code, that'sfine: just discuss about it with them first.
Depending on your editor configuration, it won't be colored like a comment,like those starting with a "#". But as any keyword can be used for wrappingan heredoc, it is easy to spot anyway. One could even come with separatedwords for different puposes, so selective extraction for different types ofdocumentation generation would be more practical. Depending on your editor,you possibly could configure it to use the same syntax highlight used formonoline comment when the keyword is one like aid or whatever you like.
Also note that the squiggly-heredoc, using "~", allow to positionthe closing term with a level of indentation. That avoids to break the visual reading flow, unlike this far too long line.aidend