SourcePoint AMD Help

Table of Contents

break

Exit from a control block.

Syntax

break

Discussion

Use the break command  to cause termination of the nearest enclosing while, do while, for, or switch command.

Example

To use a break construct to terminate the while loop when the variable n equals 0:

Command input:

define int2 n = 3t                 // define integer variable

while (1)                          // begin infinite loop

{

   n -= 1                          // decrement variable n

   printf("n=%d\n", n)             // display value of n

   if (n == 0)                     // break when n is zero

      break

}

Result:

n=2
n=1
n=0

Related Topics: