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:53:59
 
 
To
02/09/2004 07:12:30
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00938079
Message ID:
00938694
Views:
17
Fabio,

I assume this is a rise to my original challenge? Even if I haven't got the logic absolutely correct (esp. 4. as I understand you) there's nothing can't be achieved without the 3 basis constructs: sequence, loop, decision (If or Case).

Grazie

Terry


>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
1.

Do while not <condition>.
  <a long sequence of commands>
EndDo
>
>* This uses EXIT and none restriction is imposed
>
>DO WHILE .T.
>	<a long sequence of commands>
>	IF <condition>
>		EXIT
>	ENDIF
>ENDDO
>
2.  Same as 1?
>* 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
>.....
>
>
3.

Do while <condition1> ;
   and   not <condition2>
  <a long sequence1 of commands>
  If not <condition2>
      <a long sequence2 of commands>
  EndIf
EndDo
>Now I make you to anger.
AND HOW!!!
>
>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
>.....
>
4. 

Do while <condition1>
  <a long sequence1 of commands>
  Do while <condition2> ;
     and   not <condition3>
    <a long sequence2 of commands>
    If not <condition3>
        <a long sequence3 of commands>
    Endif 
  EndDo while <condition2>
  If not <condition3>
        <a long sequence4 of commands>
  Endif 
EndDo
>
>Fabio
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Previous
Reply
Map
View

Click here to load this message in the networking platform