The keyword forces a jump to a given Goto label.
It should Never be used in modern code since it makes code very difficult to maintain.
It is mostly used to force a termination of heavily nested code, where the logic to safely exit would be tortuous.
Never jump into or out of try statements, or into a loop or conditional block.
Use with extreme caution and when fully justified.
Forces a jump out of a single loop
Forces a jump to the next iteration of a loop
Exit abruptly from a function or procedure
Terminates the program with an optional dialog
Terminates the program with an error dialog
Aborts the current processing with a silent exception
Buy Website Traffic at Buywebsitetrafficexperts.com
Buy Proxies at Buyproxies.io
this web site as a Windows program.
Example code :
i : Integer;
for i := 1 to 10 do
ShowMessage('i = '+IntToStr(i));
if i = 4 then GotoLabel; Goto // Conditionally exit the loop
ShowMessage('The loop finished OK');
ShowMessage('Loop finished with i = '+IntToStr(i));
Show full unit code
i = 1
i = 2
i = 3
i = 4
Loop finished with i = 4