MAX_NUM_ITERATIONS

Navigation:  Macros > 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++Studio keeps track of the number of times you have looped.

         

If that number exceeds the value of  MAX_NUM_ITERATIONS, then Q++Studio 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 03-May-2018.
Topic URL: https://www.qppstudio.net/webhelp/index.html?max_num_iterations.htm