Part 2 of the rectangles experiment draws multiples using variables and a loop. The idea is given by the AppleSoft BASIC program. All listings are included.
AppleSoft BASIC:
10 XM = (280 / 2) – 1 : X = 0 : Y = 0 : YM = (192 / 2) – 1
20 XL = 279:YL = 191
30 HGR2 : HCOLOR= 3
40 HPLOT X,Y TO X + XL,Y
45 HPLOT TO X + XL,Y + YL
50 HPLOT TO X,Y + YL
55 HPLOT TO X,Y
60 X = X + 3:XL = XL – 6
65 Y = Y + 2:YL = YL – 4
80 IF XL > 0 THEN GOTO 40
100 GET A$
110 TEXT
120 END