[fpc-pascal] Illegal counter variable?

Markus Greim greim at schleibinger.com
Mon Sep 9 19:15:28 CEST 2019


AFAIK these is the standard behavior since the first PASCAL versions. 

We must not change it. It prevents a lot of side effects, and PASCAL is NOT C without brackets!
Use while or repeat instead!



>From Niklaus Wirths last 2004 Oberon manual: 

https://people.inf.ethz.ch/wirth/ProgInOberon2004.pdf​




t "It is recommended that the for statement be used in simple cases only; in particular, no 
components of the expressions determining the range must be affected by the repeated 
statements, and, above all, the control variable itself must not be changed by the repeated 
statements. The value of the control variable must be considered as undefined after the for 
statement is terminated."

Kind Regards


Markus

--- original message ---
On September 9, 2019, 5:20 PM GMT+2 martin at templot.com wrote:

On 09/09/2019 15:11, James Richters wrote:

>> If (I>86) And (I<95) then Continue;

>> What does continue do exactly? Loop back to the beginning of the for loop right away?


> Hi James,


> Yes in effect -- it jumps forward to the test at the end of a loop. Very 

> useful.


> See: https://www.freepascal.org/docs-html/rtl/system/continue.html


> cheers,


> Martin.

> _______________________________________________

> fpc-pascal maillist - fpc-pascal at lists.freepascal.org

> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
--- end of original message ---
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190909/f6274bb6/attachment-0001.html>


More information about the fpc-pascal mailing list