delphi - Jump to finally without exiting a function/procedure -


i have following situation:

procedure test; begin  repeat   tryagain := false;   try    // code    // code    if , begin     tryagain := true;     exit;    end;      // cleanupcode   end;  until tryagain = false; end; 

how can jump section without calling exit automatically calls repeat footer also?

use continue proceed next iteration. code in finally part of try..finally block designed executed, if force skip next iteration:

procedure tform1.button1click(sender: tobject); begin   repeat     tryagain := false;     try       if somecondition       begin         tryagain := true;         // proceed block , go repeat         continue;       end;       // code here execute if somecondition       // false, because calling continue skip           // code in block executed     end;   until     not tryagain; end; 

but same logic can write way:

procedure tform1.button1click(sender: tobject); begin   repeat     tryagain := false;     try       if somecondition       begin         tryagain := true;       end       else       begin         // code here execute if somecondition         // false       end;           // code in block executed     end;   until     not tryagain; end; 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -