       10 // DIM sample program
       20 //
       30 DIM a(4), b(-1:1, -1:1)
       40 //
       50 FOR f:=1 TO 4 DO a(f):=f
       60 //
       70 FOR f:=-1 TO 1 DO
       80   FOR g:=-1 TO 1 DO
       90     b(f, g):=f*g
      100   ENDFOR g
      110 ENDFOR f
      120 //
      130 // The following all reference non existing elements in the arrays.
      140 trep(a(0))
      150 trep(a(5))
      160 trep(b(-2, 0))
      170 trep(b(0, -2))
      180 trep(b(-2, -2))
      190 trep(b(2, 0))
      200 trep(b(0, 2))
      210 trep(b(2, 2))
      220 //
      230 FOR f:=4 DOWNTO 1 DO
      240   SYS assert, a(f)=f
      250 ENDFOR f
      260 //
      270 FOR f:=1 DOWNTO -1 DO
      280   FOR g:=-1 TO 1 DO
      290     SYS assert, b(f, g)=f*g
      300   ENDFOR g
      310 ENDFOR f
      320 //
      330 PRINT "Ok"
      340 //
      350 PROC trep(NAME x) CLOSED
      360   TRAP
      370     dummy:=x  // Must generate an error.
      380     SYS assert, FALSE
      390   ENDTRAP
      400 ENDPROC trep
