I noticed this example in the Ruby Style Guide Wiki and think it may need
changing, but don't know where to comment on it.
I didn't want to just edit the page, because I may be talking rubbish.
Original
first_name = prompt_and_read "First name"
last_name = prompt_and_read "Last name"
phone = prompt_and_read "Phone"
Better
FIELDS = [ "First name", "Last name", "Phone" ]
FIELDS.each do |prompt| ... end
I may be missing something, but I don't see how that loop can update the
three separate variables as the original does. It certainly makes the code
shorter (only by one line in this case, but it could be a lot more in
general), but doesn't seem to achieve the same effect.