Never rely on this. With optimisations on, for loops often start at the high number and work down. The variable can also be stuck in a register, which can be trashed on leaving the loop.
In short, it is undefined. Regards Sean Cross IT Systems Development Manager Catalyst Risk Management PO Box 230 50 Dalton St Napier 4140 DDI: 06-8340362 mobile: 021 270 3466 Visit us at http://www.catalystrisk.co.nz/ Offices in Auckland, Napier, Wellington & Christchurch Disclaimer: "The information contained in this document is confidential to the addressee(s) and may be legally privileged. Any view or opinions expressed are those of the author and may not be those of Catalyst Risk Management. No guarantee or representation is made that this communication is free of errors, viruses or interference. If you have received this e-mail message in error please delete it and notify me. Thank you." > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:delphi- > [EMAIL PROTECTED] On Behalf Of Ross Levis > Sent: Tuesday, 7 August 2007 3:22 p.m. > To: 'NZ Borland Developers Group - Delphi List' > Subject: [DUG] for..loop > > Why does the Delphi help say that a For loop variable has an undefined > value > after the loop finishes it's iterations? Surely the variable is always > 1 > greater than the maximum "To" value. That is what appears to happen in > all > situations I've tested. I often use this test after a For loop to tell > if > something was not found. What would cause a different result than > this? > > Cheers, > Ross. > > _______________________________________________ > NZ Borland Developers Group - Delphi mailing list > Post: [email protected] > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to [EMAIL PROTECTED] with > Subject: unsubscribe _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: [email protected] Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe
