The problem I met is I have to visit all the eight neighbors of an element [i, j]
in a 2D array.
However, considering the error of array out of bound, I have to do a lot of if else statement on [i-1, j]
or [i+1, j]
...It's kind of verbose to me.
So I wonder if there is any efficient way to implement this kind of problem in Go?
Like error-catching system?