[categories] [index] [all (553)] [latest]
struct Board {
var cells : [[Int]]
init(row:Int, columns:Int) {
self.cells = [[Int]]()
for _ in 0..<row {
self.cells.append([Int](count: columns, repeatedValue: 0))
}
}
subscript(row: Int, column: Int) -> Int {
get {
return cells[row][column]
}
set {
cells[row][column] = newValue
}
}
}
var b = Board(row: 3, columns: 4)
b[1,1] = 1
print(b[1,1])