In Golang, I want to initialize an array of arrays which can represent an year. The main array will have 12 sub-arrays each will represent a month. Each subarray will have size of the month they represent.
For eg, 0th sub-array will reference January and will contain 31 elements, 1st sub-array will reference February and will contain 29 elements (considering a leap year) and so on...
Multi-dimensional arrays are initialized like [12][30]int in Golang considering the fixed size. But here, I am working with a multidimensional array of different sizes. How do I initialize a variable with such a datatype?
In short, I want to do something like this:
var year [[31]int, [29]int, [31]int, [30]int, [31]int, [30]int, [31]int, [31]int, [30]int, [31]int, [30]int, [31]int]
But I am struggling with the syntax. Could someone please help me out? Thanks!!