Loop Next statement: Difference between revisions
Jump to navigation
Jump to search
m (Created page with "It is quite common in any programming language to have a need to exit a loop under certain conditions. <var class="product">User Language</var> provides this capability with the ...") |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
It is quite common in any programming language to have a need to | It is quite common in any programming language to have a need to | ||
exit a loop under certain conditions. | exit a loop under certain conditions. | ||
<var class="product"> | <var class="product">SOUL</var> has provided this capability with the <var>Loop End</var> statement: | ||
<p class="code">for %i from 1 to %list:count | <p class="code">for %i from 1 to %list:count | ||
print %list:item(%i) | print %list:item(%i) | ||
Line 12: | Line 12: | ||
It is almost as common to have the need to simply do the next iteration | It is almost as common to have the need to simply do the next iteration | ||
of a loop, that is, go to the top of the loop, under certain conditions. | of a loop, that is, go to the top of the loop, under certain conditions. | ||
<var class="product">SOUL</var> now provides this capability with the <var>Loop Next</var> statement: | |||
<p class="code">for %i from 1 to %list:count | <p class="code">for %i from 1 to %list:count | ||
if %list:item(%i) eq '' then | if %list:item(%i) eq '' then | ||
Line 22: | Line 22: | ||
The <var>Loop Next</var> statement takes no parameters. | The <var>Loop Next</var> statement takes no parameters. | ||
See also the <var>[[Loop End statement|Loop End]]</var> statement. | |||
[[Category: User Language statements]] | [[Category: User Language statements]] |
Latest revision as of 19:25, 10 April 2020
It is quite common in any programming language to have a need to exit a loop under certain conditions. SOUL has provided this capability with the Loop End statement:
for %i from 1 to %list:count print %list:item(%i) if %list:item(%i) eq '***END***' then loop end end if end for
It is almost as common to have the need to simply do the next iteration of a loop, that is, go to the top of the loop, under certain conditions. SOUL now provides this capability with the Loop Next statement:
for %i from 1 to %list:count if %list:item(%i) eq then loop next end if print %list:item(%i) end for
The Loop Next statement takes no parameters.
See also the Loop End statement.