Note that the range doesn't need to be converted to an array for this to work. And line 2 in the for vs loop example is invalid Ruby code, and so it raises an exception.
The code may be written like this (to include the comparison of the reports):
Line 2 was me forgetting to comment the line. The collection doesn't explicitly need to be an Array, no. Also compare! doesn't need to be explicitly called.
Also compare! doesn't need to be explicitly called.
This is true, but it then won't give you the comparison report. So it does not need to be there, it is just a nice to have. Also, not sure how to implicitly call it. To be sure, I did write in the message that it was there to show the comparison report.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Note that the range doesn't need to be converted to an array for this to work. And line 2 in the for vs loop example is invalid Ruby code, and so it raises an exception.
The code may be written like this (to include the comparison of the reports):
Line 2 was me forgetting to comment the line. The collection doesn't explicitly need to be an Array, no. Also
compare!
doesn't need to be explicitly called.This is true, but it then won't give you the comparison report. So it does not need to be there, it is just a nice to have. Also, not sure how to implicitly call it. To be sure, I did write in the message that it was there to show the comparison report.