ok so i have an array of char like this...
alphabet : array[1..26] of char = ('A','B','C','D','E','F','G','H','I','J'
'K','L','M','N','O','P','Q','R','S','T'
'U','V','W','X','Y','Z');
i tried this as a const but not luck so i moved to var now it says
Message: Cannot init array with vaue
so i removed the the letters and it worked. is the first format not allowe mpl as it is in pascal?
alphabet[1]:='A'
alphabet[2]:='B'
...
alphabet[26]:='Z'
No, you can't initialize array values when you declare them. You must
set the values in a separate statement. I also do not think that arrays can be initialized in that way. You'll have to do:
alphabet[1]:='A'
alphabet[2]:='B'
...
alphabet[26]:='Z'
alphabet[26]:='Z'
ok so i have an array of char like this...No, you can't initialize array values when you declare them. You must
alphabet : array[1..26] of char = ('A','B','C','D','E','F','G','H','I
'K','L','M','N','O','P','Q','R','S
'U','V','W','X','Y','Z');
i tried this as a const but not luck so i moved to var now it says
Message: Cannot init array with vaue
so i removed the the letters and it worked. is the first format not a mpl as it is in pascal?
set the values in a separate statement. I also do not think that arrays can be initialized in that way. You'll have to do:
alphabet[1]:='A'
alphabet[2]:='B'
No, you can't initialize array values when you declare them. You mus set the values in a separate statement. I also do not think that arr can be initialized in that way. You'll have to do:You would declare it as a string because strings are just arrays of characters:
alphabet[1]:='A'
alphabet[2]:='B'
Var
Alphabet : String[26] = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
Count : Byte;
Begin
For Count := 1 to 26 Do
WriteLn(Alphabet[Count]);
End.
Sysop: | sneaky |
---|---|
Location: | Ashburton,NZ |
Users: | 31 |
Nodes: | 8 (0 / 8) |
Uptime: | 131:57:32 |
Calls: | 2,073 |
Files: | 11,136 |
Messages: | 947,527 |