Jump to content

Flow-control structures: Difference between revisions

m
→‎{{header|REXX}}: changed a REXX program example. -- ~~~~
(→‎{{header|REXX}}: added an example of raising a condition (division by zero). -- ~~~~)
m (→‎{{header|REXX}}: changed a REXX program example. -- ~~~~)
Line 1,709:
===leave===
The '''leave''' statement transfer control to the next REXX statement following the   '''end'''   statment of the current   '''do'''   loop.   The '''leave''' statement can also specify which '''do''' loop is to be left if the '''do''' loop has a named variable.
<lang rexx> do j=1 to 10</lang>
say 'j=' j
if j>5 then leave
say 'negative j=' -j
end /*j*/
 
say 'end of the DO loop for j.'
...
ouch=60
sum=0
do k=0 to 100 by 3
say 'k=' k
do m=1 to k
if m=ouch then leave k
sum=sum+m
end /*m*/
end /*k*/
say 'sum=' sum</lang>
 
===raising conditions===
Line 1,839 ⟶ 1,822:
 
(Also, see '''raising conditions''' above.)
<lang rexx>signal on error...
signal on error
signal on failure
signal on halt
Cookies help us deliver our services. By using our services, you agree to our use of cookies.