Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Argument starter - The roots of all evil
Message
From
02/09/2004 07:12:30
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00938079
Message ID:
00938689
Views:
16
A simple example:
* on VFP, IMPLEMENT this classic programming loop
DO LOOP
	<a long sequence of commands>
ENDLOOP <condition> && exit when this is not true

* This uses EXIT and none restriction is imposed
DO WHILE .T.
	<a long sequence of commands>
	IF <condition>
		EXIT
	ENDIF
ENDDO

* this not uses EXIT, but you have to duplicate the commands or put these into a procedure
<a long sequence of commands>
DO WHILE <condition>
	<a long sequence of commands>
ENDDO

* this not uses EXIT, but you must find a name variable that it does not interfere with the program
lLoop = .T.
DO WHILE m.lLoop
	<a long sequence of commands>
	lLoop = <condition>
ENDDO
Now I use my metric, and say:
"The first solution is that one that allows to write the simpler program
that transform the DO LOOP script into a valid VFP program,
and therefore for me it is the best one."

Another example:
DO WHILE <condition1>
	<a long sequence1 of commands>
	IF <condition2>
		EXIT
	ENDIF
	<a long sequence2 of commands>
ENDDO

* implement this into VFP
.....
Now I make you to anger.

A example with a possible extension for the VFP language:
Define in nested loops a multilevel parametric LOOP command

LOOP [aNaturalIntegerExpression]

* LOOP 0 is equal to the current VFP LOOP
* LOOP 1 skip to the end of the first external loop
* LOOP 2 ....


Example:
DO WHILE <condition1>
	<a long sequence1 of commands>
	DO WHILE <condition2>
		<a long sequence2 of commands>
		IF <condition3>
			LOOP 1
		ENDIF
		<a long sequence3 of commands>		
	ENDDO
	<a long sequence4 of commands>
ENDDO && LOOP 1 go here

* implement this into VFP
.....
Fabio
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform