MAX_NUM_ITERATIONS

Navigation:  Appendices > Macro Language > Code Structure > Compiler Directives >

MAX_NUM_ITERATIONS

Previous pageReturn to chapter overviewNext page

Default value : 400

Allowed range : 25 to 2,000

 

The purpose of this directive is to avoid an accidental infinite loop while processing your Macro. Consider the following code :

 

nRunningDate = Today()

nMillenium = FirstDateOfMonth(2000, 1)

while nRunningDate <= nMillenium

 // do something …

endwhile

 

If you forget to increase the value of nRunningDate inside the while  loop, you will get an infinite loop. To protect you against this, every time you enter into a for or while loop, Q++ keeps track of the number of times you have looped.

         

If that number exceeds the value of  MAX_NUM_ITERATIONS, then Q++ will issue an error message detailing the value of the loop counter, and the assembler line where it occurred. It will then abort the script.


Topic 107016 updated on 17-Nov-2005.
Topic URL: http://www.qppstudio.net/webhelp/index.html?max_num_iterations.htm