Inno Setup Preprocessor: #for

Inno Setup Preprocessor

Inno Setup Preprocessor: #for


for-directive: for   { <expr1> ; <expr2> ; <expr3> } <expr4>


Use the for directive to get loop behaviour. for takes 4 expressions. The first expression (expr1) is called "initialization expression," the second expression (expr2) "condition," the third expression (expr3) "action," and the final expression (expr4) "loop body."

The logic the for directive follows is:

  1. The initialization expression is evaluated.

  2. The condition is evaluated. If it evaluates to 0, the loop ends.

  3. The loop body is evaluated.

  4. The action is evaluated.

  5. Process repeats from 2.


// Call AddFile user defined procedure 200 times
#for {i = 200; i > 0; i--} AddFile

More examples

FindFirst, FileRead.

See also

sub, include.