Continue (keyword)

From RemObjects Software

Jump to: navigation, search

This is a Oxygene Keyword topic
Feel free to add your notes to this topic below.



The continue statement can be used to short circuit a pass within a loop. You should not expect to need this very often because often there is a better way of obtaining your objective. For example, code can be factored out to another method or you can place your code within if/then/else.

It can be useful though for the following type of code:

while isLive do begin
  if not test0 then isLive:=False;
  if not test1 then continue;

  //  first action(s)
  if not test2 then continue;

  // second action(s)
  if not test3 then continue;

  // final action(s)
end;

The code above could be replaced by nested if statements, but it is much clearer as written.

IMPORTANT: the code illustrates a trap for the unwary. You must ensure that continue does not bypass setting the break out of the loop. Note that the isLive check is placed before any code can be bypassed.

See Also


Product: RemObjects Oxygene (formerly known as Chrome)
Current version: 3.0 Previous Versions: 'Joyride' (2.0), 'Floorshow' (1.5), 'Adrenochrome' (1.0)

GlossaryKeywordsLanguage FeaturesPlatform FeaturesSamplesArticlesHow ToIssues

Personal tools