
-----------------------------------
chees
Fri Jan 06, 2006 5:12 pm

What is the equivilent in Turing to this VB command?
-----------------------------------
What is the turing equivilent to the VB command "GoTo". I would like to use it in a program. Thx!

-----------------------------------
cool dude
Fri Jan 06, 2006 5:39 pm


-----------------------------------
GoTo is a really bad command that will lead to complications later on in your program. it really shouldn't be used, besides i don't think there is one in turing. 

P.S. just wondering how u have -7 bits

-----------------------------------
chrispminis
Fri Jan 06, 2006 5:56 pm


-----------------------------------
A mod or admin took some bits away from him, for whatever reason. There isn't a GoTo but you can call procedures, which i spose is sort of like it. look up the turing help file or tutorials for procedures, not processes (those are bad), procedure.

-----------------------------------
MysticVegeta
Sat Jan 07, 2006 11:54 am


-----------------------------------
Procedures and/or functions could be used. Although I still think the Goto commands are more efficient because you could make the program goto a specific line although it could still be achieved in Turing but simplicity is the key.

-----------------------------------
Cervantes
Sat Jan 07, 2006 3:29 pm


-----------------------------------
but simplicity is the key.
Logic flow and structure are the keys.  Using 'Goto' abolishes those.

-----------------------------------
Tony
Sun Jan 08, 2006 3:18 am


-----------------------------------
I still think the Goto commands are more efficient because you could make the program goto a specific line
To continue Yet Another GoTo Debate...

What if you then need to edit the program, and add or remove a line of code? Would that not make all GoTo's point to an 'incorrect' line?

As Cervantes said -- Logic flow and structure

-----------------------------------
Cervantes
Sun Jan 08, 2006 8:20 am


-----------------------------------
What if you then need to edit the program, and add or remove a line of code? Would that not make all GoTo's point to an 'incorrect' line?


Ideally, you can add 'labels' to various points, then GoTo the label of your choice.  

Failing that, you label the line number, but don't incriment by 1.  Rather, you incriment by 10, or perhaps even larger.  Still a terrible idea, but not as bad as you made it sound.  For example,


 10 INPUT "What is your name: "; U$
 20 PRINT "Hello "; U$
 25 REM
 30 INPUT "How many stars do you want: "; N
 35 S$ = ""
 40 FOR I = 1 TO N
 50 S$ = S$ + "*"
 55 NEXT I
 60 PRINT S$
 65 REM
 70 INPUT "Do you want more stars? "; A$
 80 IF LEN(A$) = 0 THEN GOTO 70
 90 A$ = LEFT$(A$, 1)
100 IF (A$ = "Y") OR (A$ = "y") THEN GOTO 30
110 PRINT "Goodbye ";
120 FOR I = 1 TO 200
130 PRINT U$; " ";
140 NEXT I
150 PRINT


-----------------------------------
Tony
Sun Jan 08, 2006 1:08 pm


-----------------------------------
the problem is that you need to keep on top of all the "exits" with a GoTo Back type of deal. You could return to a "line" from any location, but unless you explicitly set flags and check for them, the program will not know where the logic flow came from.

-----------------------------------
MysticVegeta
Sun Jan 08, 2006 1:39 pm


-----------------------------------
I still think the Goto commands are more efficient because you could make the program goto a specific line
To continue Yet Another GoTo Debate...

What if you then need to edit the program, and add or remove a line of code? Would that not make all GoTo's point to an 'incorrect' line?

As Cervantes said -- Logic flow and structure

Hey come on guys. I am not an advanced guy in programming lol. But yeah that would make us point to incorrect portion of code but so will other things such as if you have a procedure "x" and you are linking to that procedure from different parts of your program you will stil have to edit it just like GoTo .  :lol:

-----------------------------------
Tony
Sun Jan 08, 2006 1:44 pm


-----------------------------------
I am not an advanced guy in programming lol. But yeah that would make us point to incorrect portion of code but so will other things such as if you have a procedure "x" and you are linking to that procedure from different parts of your program you will stil have to edit it just like GoTo .  :lol:
The difference is that that when the procedure is over, the control is returned back to where the said procedure was called from. You _know_ your entry/exit points. With GoTo, you have to program in your exit with another GoTo, and keep track of both, plus any additional flags.
