Loop structures: Difference between revisions

Content added Content deleted
(Loop Structures in FeeBASIC)
Line 285: Line 285:
error" Ran out of records looking for the right one!"
error" Ran out of records looking for the right one!"
THEN
THEN


=={{header|FreeBASIC}}==
<h3>[[While_loop|While..Wend]]</h3>
Executes a block of statements while a condition is met.<br>
<syntaxhighlight lang="vbnet">While [ condition ]
[ statement block ]
Wend</syntaxhighlight>

<h3>[[For_loop|For..Next]]</h3>
Executes a block of statements while an iterator is less than or greater than an expression.<br>
<syntaxhighlight lang="vbnet">For iterator [ As datatype ] = startvalue To endvalue [ Step stepvalue ]
[ statement block ]
Next [ iterator ]
</syntaxhighlight>

<h3>[[While_loop|Do..Loop]]</h3>
Executes a block of statements while or until a condition is met.
<syntaxhighlight lang="vbnet">Do [ { Until | While } condition ]
[ statement block ]
Loop</syntaxhighlight>
or
<syntaxhighlight lang="vbnet">Do
[ statement block ]
Loop [ { Until | While } condition ]
</syntaxhighlight>

<h3>Intra-loop control</h3>
Continue While, Continue For and Continue Do
Prematurely re-enters a loop.<br>
<syntaxhighlight lang="vbnet">Continue {Do | For | While}</syntaxhighlight>
Exit While, Exit For and Exit Do
Prematurely breaks out of a loop.
<syntaxhighlight lang="vbnet">Exit {Do | For | While | Select }</syntaxhighlight>
<syntaxhighlight lang="vbnet">Exit {Sub | Function | Operator | Constructor | Destructor | Property }</syntaxhighlight>

<syntaxhighlight lang="vbnet">Exit {Do [, Do [ , ...] ] |
For [, For [ , ...] ] |
While [, While, [...] ] |
Select [, Select [ , ...] ] }</syntaxhighlight>



=={{header|Frink}}==
=={{header|Frink}}==