I just noticed this really nice compiler feature. I don't know when it as
added but it's really helpful.
When defining const array like below the compiler will tell you how many
elements are missing:
const
Food: array[0..7] of string = (
'Apple', 'Banana', 'Cherry', 'Doughnut', 'Eclair');
Error: Expected another 3 array elements
And when you have too few elements in the array in it will make tell you
the point where it expected the array to end.
const
Food: array[0..2] of string = (
'Apple', 'Banana', 'Cherry',| 'Doughnut', 'Eclair');
Fatal: Syntax error, ")" expected but "," found,
And in Lazarus the caret is placed where the array should have ended "|".
This is really great feature and helps a lot when declaring array constants
with many items. Thank you to whomever added this to the compiler :)
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal