3 ms·
Right. I know it works with numeric indexes in Pascal. My point was that (using my previous example) in Ada it works with any discrete type, in that case charac
by Jtsummers 6y ago
Right. I know it works with numeric indexes in Pascal. My point was that (using my previous example) in Ada it works with any discrete type, in that case characters (which are not numbers in disguise in Ada) so I can do this:
Histogram : Character_Histogram;
...
Histogram['A'] := Histogram['A'] + 1;
(Ok, a bit more work because I didn't initialize the histogram to 0.)
- Lucretia9 6y agoSquare brackets are coming, so you'd have to use ('A')
- Jtsummers 6y agoHah, I've been in Go lately so my brain defaulted to the wrong thing in that example.
- FpUser 6y agoPascal (well Delphi/FreePascal incarnation) also works with chars and enums. This modern pascal is very feature rich and has plenty of fancy bells and whistles.
- kwhitefoot 6y agoIt works with any ordinal type in Pascal, including characters, booleans and enums.