Ruby中的多行注释?

  • 回答 (2)
  • 关注 (0)
  • 查看 (74)

如何设置Ruby的多行注释呢?

爹说的都是真理爹说的都是真理提问于
鲁大师回答于
大叔也犯二为了此岸的完整构建永无法到达的彼岸回答于
#!/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 o
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.

扫码关注云+社区

领取腾讯云代金券