Ada - Column Matrix from 2D array type

Viewed 90

I'm new to Ada. I try to initialize the 2D array that have 2x1 dimension. But I don't know how to do this, if I do something like 1..1 I will get an error.

    type Matrix is array(Integer range <>, Integer range <>) of Integer;

    V : Matrix(1..2, 1..3) := (
         (1, 4, 5),
         (2, 5, 3)
    );

    -- Here is my problem !
    U : Matrix(1..2, ???) := ( 
         (1),
         (1)
    );

1 Answers

The solution,

    U : Matrix(1..2, 1..1) := (
        (1 => 1),
        (1 => 1)
    );
Related