Rows can have different lengths:
jagged := [][]int{
{1},
{2, 3},
{4, 5, 6},
}
This creates a triangle shape. Each row is independent. Access with jagged[row][col]. Check row length before accessing columns.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
Variable row lengths
Rows can have different lengths:
jagged := [][]int{
{1},
{2, 3},
{4, 5, 6},
}
This creates a triangle shape. Each row is independent. Access with jagged[row][col]. Check row length before accessing columns.