Is Ruby able to understand in-line comments like:
my_array = ['first', /* 'second', */ 'third', 'fourth']
?
Update:
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.
Single-Line Comments The Ruby single-line comment begins with the # character and ends at the end of the line. Any characters from the # character to the end of the line are completely ignored by the Ruby interpreter.
Inline comments are comments made by an instructor that appear directly on top of your paper. These comments are usually brief.
A magic comment changes the behavior of the Ruby interpreter in some way. For example: The frozen_string_literals comment will make your strings frozen by default. It looks like this: # frozen_string_literal: true. Another magic comment allows you to change the file's encoding.
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', 'third', 'fourth']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With