1. Computing

in TIPS ::

The Goto statement transfers program execution to the statement marked by the specified label.

Read this again! Goto does not "ask questions", it simply forces a jump to some other location in the code block. When badly used Goto could transform your code into a non-readable piece of junk.

Be it bad or good, Goto is in Delphi and you might need to use it, or at least need to understand how it works.

Read the full tip to learn how Goto can be used, and when it should not be used

Related: Poll: Are you using the Goto statement in Delphi? | How I (Almost) Ended Up Using Goto in Delphi code | RTL's flow control routines (Abort, Break, Continue, Exit)

Comments
November 29, 2006 at 11:02 am
(1) Henning Mogensen says:

I never use it as part of the final code, but I use it A LOT for debugging. For that purpose it is very handsome.

November 29, 2006 at 12:37 pm
(2) Lars-Göran Andersson says:

Your solution:
if L in LL then
if L.Parent in CC then
Process L as LL ; C as CC
else
if L in CC then GOTO skip
else
skip:
if L in CC then
Process L as CC
else
Process L as any other folder
end

Why not use this?
Wouldn’t this solve your problem?

if (L in LL ) and (L.Parent in CC) then
Process L as LL; C as CC
else if L in CC then
Process L as CC
else
Process L as any other folder
end

Probably I have misunderstod your problem but?

November 30, 2006 at 10:59 am
(3) Wim van der Vegt says:

Hi

The quicksort code by Wirth uses goto’s to clearify code.

November 30, 2006 at 11:00 am
(4) Wim van der Vegt says:

Btw the best example ever saw was:

if (a=b) then
do something usefull
else
goto end;
:end;

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

©2014 About.com. All rights reserved.