ExitWhile
ExitWhile
 
Parameters: NONE
Returns: NONE
 

     ExitWhile will force PlayBASIC to break out of the current While-EndWhile loop that is being executed.



FACTS:


     * Only works within While-EndWhile loops.

     * When an ExitWhile command is executed, PlayBASIC will stop the loop and continue the program code following the EndWhile statement.



Mini Tutorial:


     Breaking free of While-EndWhile when a testing condition is met before the loop reaches it natural ending condition.
  
; a simple While-EndWhile loop
  While i < 100
     Inc i
     Print i
   ; Exit the While-EndWhile loop if i equals 9
     If i = 9 Then ExitWhile
  EndWhile
  Print "This program has ended.."
  
; display the screen and wait for a key to be pressed
  Sync
  WaitKey
  
  



This example would output.

  
  0
  1
  2
  3
  4
  5
  6
  7
  8
  9
  This program has ended..
  

 
Related Info: Continue | Do | Exit | For | Goto | Loops | Repeat | While :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com