title: Array declaration and manipulation in postgresql
body: <p>I would like to understand why the code below isn't working. I am using postgres 13, it is saying &quot;syntax error near nu int[]&quot; underlining int. I am trying to get started with array manipulation.</p>
  <pre><code>DECLARE
      num int[] := '{1, 2, 3, 4, 5}';
      s int := 0;
      x int;
  BEGIN
      
      FOR x IN 1..5 LOOP
          s:= s + num[x];
      END LOOP;
  END;
  </code></pre>