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
Post a Comment