SourcePoint AMD Help

Table of Contents


Group and execute commands while a condition is true.


while(bool-cond) {commands}



specifies a number or an expression that is evaluated and tested. The loop repeats until expr evaluates to false (zero).  The parentheses are required.


specifies any emulator commands. When you enter more than one command, you must enclose them in braces ({ }).


Use the while control construct to execute the specified commands 0 (zero) or more times, as long as bool-cond evaluates to true (non-zero).  To break out of a loop press ctrl+break.

Note: The include command is not executable inside a while control.

Example 1

The following example demonstrates a while control construct. While the index is greater than zero, decrement the index and add 5 to the sum on every iteration of the loop.

Command input:

define ord1 i = 5
define ord1 sum = 0
while (i > 0)


   i -= 1

   sum += 5

   printf("i = %d sum = %d\n", i, sum)



i = 4 sum = 5
i = 3 sum = 10
i = 2 sum = 15
i = 1 sum = 20
i = 0 sum = 25

Related Topics: