Viva Clipper !

DO WHILE..ENDDO Loop

Advertisements

Control Structures – DO WHILE..ENDDO Loop

 

/*

Control Structures - DO WHILE..ENDDO Loop

 Second kind of looping structure is DO WHILE..ENDDO Loop. 

 When the repetion count is unknown, FOR...NEXT isn't appropriate for looping; 
 thus, DO WHILE..ENDDO Loop is used for primarily for such situations. 

 Famous 

 DO WHILE .NOT. EOF() 
    ... 
    SKIP 
    ... 
 ENDDO

 loop is probably most used kind of this loop structure. 

 This example is a simple digital watch that run until any key pressed.

 For more information refer here  
*/

PROCEDURE Main()
  CLS

  cTime := TIME()

  nKey := 0

  DO WHILE nKey = 0
    @ 0,70 SAY cTime
    DO WHILE cTime = TIME()
    ENDDO
    cTime := TIME()
    nKey := INKEY()
  ENDDO 

RETURN // Main()
Advertisements

Advertisements