Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Engineering

Stopping a DO loop: break and breakif

  • Last UpdatedOct 24, 2022
  • 1 minute read

If the to option is not given, the command block within the loop will be repeated indefinitely. To stop looping, use either the break or breakif command:

do !Number

 if (!Number GT 100) then

 break

 endif

 !Result = !Result + !Number

enddo

do !Number

 break if (!Number GT 100)

 !Result = !Result + !Number

enddo

Any expression may be used with the breakif command, even a PML function, provided the result is BOOLEAN (as in, TRUE or FALSE).

The ( ) parentheses are optional but recommended.

The loop counter variable retains the value it had when the break from the loop occurred.

Related Links
TitleResults for “How to create a CRG?”Also Available in