DO WHILE..ENDDO Loop

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

One response to “DO WHILE..ENDDO Loop

  1. Pingback: Harbour Statements | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.