" CS 1621 Fall 2005 Simple demonstration of a new subclass of Array to represent 2-dimensional data" | m1 m2 m3 m4 | m1 := TwoDArray rows: 3 cols: 5. m2 := TwoDArray rows: 3 cols: 5. 1 to: (m1 getrows) do: [ :i | 1 to: (m1 getcols) do: [ :j | m1 atrow: i atcol: j put: (i+j). m2 atrow: i atcol: j put: (i*j). ]. ]. m3 := m1 + m2. (m1 printString) printNl. ' + ' printNl. (m2 printString) printNl. ' = ' printNl. (m3 printString) printNl. " The statements below will produce an error because the arrays are not compatible. We could take a less extreme action if we wished" m4 := TwoDArray rows: 4 cols: 5. m3 := m1 + m4. !