Swift
swift - map / with index
let numbers = [7, 8, 9, 10] let indexAndNum: [String] = numbers.enumerate().map { (index, element) in return "\(index): \(element)" } print(indexAndNum) // ["0: 7", "1: 8", "2: 9", "3: 10"] board가 아래와 같다면, [0,0,0,0,0], [0,0,1,0,3], [0,2,5,0,1], [4,2,4,4,2], [3,5,1,3,1]
2021. 11. 20. 00:22