Repeats the specified boolean subquery until it returns false.

This function allows you to organize loops within your FlexQuery expressions.

Warning: This function is one of very few means that can hang your template. Be careful when using it!

Parameter:

query

The subquery to be executed repeatedly.

The subquery should be created using BooleanQuery() function.

The subquery should return true to indicate that it must be repeated again or false to stop repetitions.

Returns:

The number of times the subquery has been executed (repeated).

Example:

The following expression will print on console the numbers from 1 to 10:


n = 1;      // current number
n_max = 10; // maximum number

repeat (BooleanQuery ({

  echo (n);    // print the current number
               // on console

  n = n + 1;   // increment the number
               // for the next step

  (n <= n_max) // check whether to continue
}))
See Also:
BooleanQuery()