Index out of range in multidimensional array in Swift -
this question has answer here: swift 3 2d array of int 2 answers var tri = [[int]](); tri[0][0] = 321; this code causes error: fatal error: index out of range what's wrong? you're accessing first element of first subarray of array. array doesn't contain subarrays, crashes.