2010/9/12 Frank Church <vfcli...@gmail.com>: > I need to elaborate more on this code > > On this line > > d := stTypes[i - Ord(low(stType))]; > > since stTypes is an array, I expect stTypes[n], with n being 1 to 4, to > retrieve an array value and as 'i - Ord(low(stType)) evaluates to integer it > should compile but it generates an error. > > What would be the correct way? > > On 12 September 2010 12:51, Frank Church <vfcli...@gmail.com> wrote: >> >> program testnums; >> //{$APPTYPE CONSOLE} >> >> uses >> Classes, SysUtils; >> type >> stType = (stLite := -100, stDb, stBothLite, stBothDb); //settings >> location Type >> stTypes = Array [stType] of integer; >> var >> d : stType; >> s : string; >> i : integer;
>> begin >> writeln(''); >> for i := Ord(low(stType)) to Ord(high(stType)) do for d:= low(stType) to high(stType) do >> begin >> d := stTypes[i - Ord(low(stType))]; i := stTypes[d]; >> writestr(s,d); >> writeln(d + ' ' + IntToStr(Integer(i))); >> end; >> readln; >> >> end. >> >> -- >> Frank Church >> >> ======================= >> http://devblog.brahmancreations.com > > > > -- > Frank Church > > ======================= > http://devblog.brahmancreations.com > > _______________________________________________ > fpc-pascal maillist - fpc-pas...@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal