Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 What is the equivilent in Turing to this VB command?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
chees




PostPosted: Fri Jan 06, 2006 5:12 pm   Post subject: 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!
Sponsor
Sponsor
Sponsor
sponsor
cool dude




PostPosted: Fri Jan 06, 2006 5:39 pm   Post subject: (No subject)

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




PostPosted: Fri Jan 06, 2006 5:56 pm   Post subject: (No subject)

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




PostPosted: Sat Jan 07, 2006 11:54 am   Post subject: (No subject)

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




PostPosted: Sat Jan 07, 2006 3:29 pm   Post subject: (No subject)

MysticVegeta wrote:
but simplicity is the key.

Logic flow and structure are the keys. Using 'Goto' abolishes those.
Tony




PostPosted: Sun Jan 08, 2006 3:18 am   Post subject: (No subject)

MysticVegeta wrote:
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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Cervantes




PostPosted: Sun Jan 08, 2006 8:20 am   Post subject: (No subject)

Tony wrote:
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,

Wikipedia wrote:

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




PostPosted: Sun Jan 08, 2006 1:08 pm   Post subject: (No subject)

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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
MysticVegeta




PostPosted: Sun Jan 08, 2006 1:39 pm   Post subject: (No subject)

Tony wrote:
MysticVegeta wrote:
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 . Laughing
Tony




PostPosted: Sun Jan 08, 2006 1:44 pm   Post subject: (No subject)

MysticVegeta wrote:
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 . Laughing

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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 10 Posts ]
Jump to:   


Style:  
Search: