Hello (;
While doing the adventofcode day 3, I tried to assign an instance variable from a block argument, which seems to be an invalid syntax:
(base_x..target_y).each do |x|
@current_x = x
occupied_cells << {@current_x, @current_y}
end
# VS
# expecting block argument name, not INSTANCE_VAR
# |
# V
(base_y..target_y).each do |@current_y|
# @current_y = y
occupied_cells << {@current_x, @current_y}
end
Good idea? Maybe we can add it?
NOTE: I’m not sure where to post a suggestion like this in the forum, I sense that Help & Support is the wrong category for the others doesn’t feel right either… Where should this go?