[fpc-pascal] For Loop with QWord
Bart
bartjunk64 at gmail.com
Tue Jan 3 15:53:04 CET 2023
On Tue, Jan 3, 2023 at 3:49 PM James Richters via fpc-pascal
<fpc-pascal at lists.freepascal.org> wrote:
> Var
>
> I: QWord;
>
> Begin
>
> For I := 1 To N Do
> It generates an error:
> Error: Ordinal expression expected
> If I change it to LongInt, then it works, but the question is, why can’t I use a Qword here if I know I will never need I to be a negative number?
IIRC then you can only use native type or smaller as a loop variable
in for loop.
You can use it in a while or repeat loop though.
On 64-bit you can use qword as a loop variable in a for loop.
--
Bart
More information about the fpc-pascal
mailing list