Difference between GOTO and LOOP
- anthonyk123
- Thread is Unresolved
-
-
With the label you can't be shure that there is no other jump to the label than at the end of the 'loop', without analyzing the code. Function is the same.
-
LOOP/ENDLOOP is a rigid construct. it is a 1:1 matching pair of instructions that are at the same level.
GOTO/LABEL is a loose construct with possibility of 1:many relationship where instructions are not necessarily at the same level. this makes it possible to jump out of the loops for example, jump to earlier program line etc. this loose relationship makes it possible for some interesting and also usually very sketchy uses. these abuses are normally reason for most people frowning at GOTO instructions.
-
How do you declare a label name using the teach pendant?
-
exactly the same way you enter LOOP/ENDLOOP - you type it in.
-
Just type in the characters followed by the colon.
-
Thanks for the help. Just realized I had the colon in front instead of behind. I thought I had to declare the label in the .Dat file
-
this is very basic and well documented feature. also an example of GOT and label is shown at the top of the thread - in the very first post.