What I want is to define an array of Strings in Ada.

I'm trying to execute this code:

```
type String is array (Positive range <>) of Character;
type lexicon is array(1..7) of String(1..20);
nomFumadors : lexicon := ("Macia","Xisco","Toni","Laura","Rocky","Paz");
nomNoFumadors : lexicon := ("Marina","Marta","Joan","Africa","America");

```

And the compiler says:

```
warning:wrong length for array of subtype of "String" defined at line 42

```

My line 42 is this:

```
type lexicon is array(1..7) of String(1..20);

```

But compailer says the warning is in line 43 and 44: what are these:

```
nomFumadors : lexicon := ("Macia","Xisco","Toni","Laura","Rocky","Paz");
nomNoFumadors : lexicon := ("Marina","Marta","Joan","Africa","America");

```

Can somebody help me with that?
['https://Stackoverflow.com/questions/70968102', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/12058857/']
Another option is `Unbounded_String` (as its name suggests, length is variable and unlimited):

```
with Ada.Strings.Unbounded;

procedure Fumador is
  use Ada.Strings.Unbounded;

  subtype VString is Unbounded_String;
  function "+" (Source : in String) return VString renames To_Unbounded_String;

  type Lexicon is array (Integer range <>) of VString;  --  Unknown number of people.
  nomFumadors : Lexicon := (+"Macia", +"Xisco", +"Toni", +"Laura", +"Rocky", +"Paz");
  nomNoFumadors : Lexicon := (+"Marina", +"Marta", +"Joan", +"Africa", +"America");

begin
  null;
end;

```
Another solution is to use String, truncate long strings, and pad short strings:

```
Max : constant := 20;
subtype S20 is String (1 .. Max);
type Lexicon is array (1 .. 7) of S20;
function To20 (S : in String) return S20 is
   (if S'Length >= Max then S (S'First .. S'First + Max - 1)
    else S & (S'Length + 1 .. Max => ' ') );
V : Lexicon := (To20 (""), To20 ("Hello"), To20 ("1234567890123456789012345"), ...

```