Hi Simon

I'm trying to figure this out, too. This is how a FOR loop is supposed to operate - the test exceeds the limit.

The original question was why we start with 1 - example given was a FOR loop - but I suspect the question was really about array bases - zero-based for C/C++, say. I and others have offered some speculation on that, and have moved tangentially into errors when the loop counter may exceed the limits of the data type used for that variable. So I'm flatly getting a little lost!! See my last post in response to this.

Back to sawing logs - ZZZZZZ!
Vern

Simon Coulter wrote:
On 02/02/2009, at 9:49 PM, David FOXWELL wrote:

After
for i = 0 to numberloops-1;
Index = i+1;
endfor;

i = numberloops,

But after
for i = 1 to numberloops;
Index = i;
endfor;

I= numberloops + 1.


In both cases i is one greater than the loop limit so perhaps you can explain exactly what are you trying to prove?

Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists

http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.