Forum > Beginners

GoTo Statement

(1/5) > >>

JLWest:
I have a procedure I can't make work. So I'm thinking of trying it with a GOTO statements.

If I set  {$GOTO ON}  and  {$GOTO OFF} as such  will that turn it off and within the block.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.SetSize( ASTRING : String); var Line : String;begin   {$GOTO ON}    ....   GOTO  Label1:   ....  Label1:   ....   GOTO Label6:   ....  Label6:   .... {$GOTO OFF} end; 

Zvoni:
Huh? What's wrong with nested Function/Procedure?

JLWest:
I posted in beginners. I have never used a nested function/procedure but maybe.

devEric69:
Labels must be declared below variables: please, read https://wiki.lazarus.freepascal.org/Goto/fr and  https://wiki.lazarus.freepascal.org/Goto .
I really like to use labels inside loop ( and I'm not a newbie in turbo-Pascal ;) ):



--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---for iFoo:= iThis to iThere the begin  ...\...  j:= calcHere;   if j = 0 then goto lblFooNext;  ...\...lblFooNext:end;

Zvoni:

--- Quote from: JLWest on September 14, 2021, 08:51:14 am ---I posted in beginners. I have never used a nested function/procedure but maybe.

--- End quote ---
Post your Procedure you can't get to work, and comment where you want when to jump to

Navigation

[0] Message Index

[#] Next page

Go to full version