title: Finding neighbours in a two-dimensional array
body: <p>Is there an easy way of finding the neighbours (that is, the eight elements around an element) of an element in a two-dimensional array? Short of just subtracting and adding to the index in different combinations, like this:</p>
  
  <pre><code>array[i-1][i]
  array[i-1][i-1]
  array[i][i-1]
  array[i+1][i]
  </code></pre>
  
  <p>... And so on.</p>