@@ -31,7 +31,7 @@ var Array2DNumbers = Array2D(columns: 3, rows: 5, initialValue: 0)
31
31
// makes an array of rows * columns elements all filled with zero
32
32
print ( Array2DNumbers . array)
33
33
34
- //setting numbers
34
+ // setting numbers using subscript [x, y]
35
35
Array2DNumbers [ 0 , 0 ] = 1
36
36
Array2DNumbers [ 1 , 0 ] = 2
37
37
@@ -48,17 +48,9 @@ Array2DNumbers[2, 3] = 9
48
48
// now the numbers are set in the array
49
49
print ( Array2DNumbers . array)
50
50
51
- // printint out the 2D array with a reference around the grid [x, y]
52
- print ( " " , terminator: " " )
53
- for k in 0 ..< Array2DNumbers . columns {
54
- print ( " \( k) " , terminator: " " )
55
- if ( k == Array2DNumbers . columns - 1 ) {
56
- print ( " x " )
57
- }
58
- }
59
-
51
+ // print out the 2D array with a reference around the grid
60
52
for i in 0 ..< Array2DNumbers . rows {
61
- print ( " \( i ) [" , terminator: " " ) ;
53
+ print ( " [ " , terminator: " " ) ;
62
54
for j in 0 ..< Array2DNumbers . columns {
63
55
if ( j == Array2DNumbers . columns - 1 ) {
64
56
print ( " \( Array2DNumbers [ j, i] ) " , terminator: " " ) ;
@@ -68,6 +60,6 @@ for i in 0..<Array2DNumbers.rows {
68
60
}
69
61
print ( " ] " ) ;
70
62
}
71
- print ( " y " )
63
+
72
64
73
65
0 commit comments