#Break
#Break [ExecutionCounter]
 
Parameters:

    [ExecutionCounter] = The number of times this statement can be executed before it halts the program
Returns: NONE
 

      #Break allows us to insert what are known as Break Points into a program. These Break Points are used to force a program to stop running at any specific point. Once the program has halted at a break, you can then use the built in run time debugger to investigate the current status your program. This includes not only the current line it's executing, but information about your variables and arrays also. This can be an invaluable feature when your program may not be functioning how you might like.

      By default, #Break will halt a program the first time it's executed. In most cases this is perfect, but some times you may not want it to halt on the first execution. To counter this, #Break has a optional execution parameter. When this parameter is provided, #break will decrease this counter each time it's executed (without stopping) until it reaches zero. Upon reaching zero, it will halt execution as normal. This is ideal for trying to locate problems within loops for example.



FACTS:


      * #Break command is only available when a program is compiled in a DEBUG mode.




Mini Tutorial:


      Using #Break counter to halt the execution of a loop. Press F6 or F7 to compile and execute in either debug modes.


  
  
  For lp=0 To 10
     Print lp
     #Break 5
  Next
  
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  



When this example is complied in any DEBUG mode it would output the following, halting after the loop has been executed at least 5 times.

  
  1
  2
  3
  4
  5
  6
  7
  8
  9
  10
  

 
Related Info: #Cls | #Print | #Trace :
 


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