Reputation:
I'm fairly new to ruby. I've noticed that multiline comments are not nestable. This code causes an error:
=begin
=begin
=end
=end
this is the error:
SyntaxError: (irb):4: syntax error, unexpected '='
from C:/Ruby/bin/irb.cmd:19:in `<main>'
Is there a way to nest comments in ruby?
Upvotes: 4
Views: 434
Reputation: 1077
I don't believe there is. The problem ruby sees here is like this:
=begin # start comment
=begin # still commenting
=end # end commenting
=end # wtf is this?
Upvotes: 4