Initialize multidimensional array

From CodeCodex

Implementations[edit]

Java[edit]

Simply use braces...

static double[][] Rates = {
    {0.50, 0.70,  0.40, 0.60},
    {0.50, 1.10,  0.50, 0.80},
    {0.80, 1.60,  0.70, 1.20},
    {1.50, 2.90,  1.20, 2.10},
    {2.50, 4.90,  2.00, 3.30},
    {4.60, 8.50,  3.20, 5.00},
    {6.40,11.00,  4.10, 6.00}
};

Ruby[edit]

Rates = [[0.50, 0.70,  0.40, 0.60],
         [0.50, 1.10,  0.50, 0.80],
         [0.80, 1.60,  0.70, 1.20],
         [1.50, 2.90,  1.20, 2.10],
         [2.50, 4.90,  2.00, 3.30],
         [4.60, 8.50,  3.20, 5.00],
         [6.40,11.00,  4.10, 6.00] ]