Nested multiline comments in ruby?

Viewed 315

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?

1 Answers

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?
Related