Paul Paul - 2 years ago 126
Ruby Question

Inline comments in Ruby

Is Ruby able to understand in-line comments like:

my_array = ['first', /* 'second', */ 'third', 'fourth']



I asked not about what is /* */ in Ruby and why I receive an error, but about presence of in-line comments in any available form at all. /* */ were given only as example of in-line comments known to me.

Answer Source

No, Ruby does not have inline comments.

Comments of this style have a tendency to reduce readability, since they makes the code harder to follow.

In your case it would be best to split your array items into separate rows and comment out the one row.

my_array = ['first',
#           'second',
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download