I'm approaching the Ada language. I wrote this simple program that loops over an array and increments every single value, but the compiler gives me an error of type:
hello.adb:8:07: left hand side of assignment must be a variable
The program in question is this:
with Ada.Text_IO;
procedure hello is
type myArrayDefinition is array (1 .. 10) of integer;
myArray : constant myArrayDefinition := (1 => 3, others => 2);
begin
for A in 1 .. 10 loop
myArray(A) := myArray(A) + 1;
end loop;
end hello;
Could anyone help me to understand the problem?
myArrayisn't a variable, it's a constant.