"one generally expects the return value to be of interest, but that's not the case here" I don't think it's a valid point.
#each
also returns a value, but I rarely see it assigned at all. @Mooch feel free to use any of the working suggestions. The one with method is ok, the one with an extra
each
is confusing and would rather not pass a code review. I think it's worth getting yourself familiar with the
inject
approach, but it may be too soon if you're learning basics - make a note and come back to it when you're up for a challenge. Good luck on your Ruby journey! —
Greg 31 secs ago