This works. Its BlitzMax code - you didn't specify what you were using. But whatever, its not hugely different to what its Blitz3D/Blitzplus version would be.
Graphics 800,600 'define a two dimensional array Global myArray[10,10] 'in blitzmax this creates an array 0-9,0-9. 'start by going up the left hand side as a starting point.... For yPos = 9 To 1 Step -1 doStuff(1,yPos) drawArray() Next '.....then across the top For xpos = 2 To 9 ' already done square 1,1 above. doStuff(xPos,1) drawArray() Next '....functions Function doStuff(xP,yP) Local xMax = 9 Local yMax = 9 'reset all array to 0's For X = 1 To 9 For Y = 1 To 9 myArray[X,Y] = 0 Next Next 'set 1's in diagonal lines For N = 0 To 9 If xP+N <= xMax If yP+N <= yMax 'check x/y are within bounds of array myArray[xP+N,yP+N] = 1 EndIf EndIf Next End Function Function drawArray() Cls For X = 1 To 9 For Y = 1 To 9 DrawText myArray[x,y],x*10,y*10 Next Next Flip Delay 500 End Function