04-16-2008, 09:44 AM
Does anyone else use goto to write spaghetti programs like me?
WHILE RPG$ <> "complete" : make up silly excuses :WEND
Poll: What do you think about using goto in your programs? You do not have permission to vote in this poll. |
|||
Always use GOTO | 0 | 0% | |
Often use GOTO | 3 | 37.50% | |
Somtimes use GOTO | 1 | 12.50% | |
Rarely use GOTO | 3 | 37.50% | |
Don\'t use GOTO | 1 | 12.50% | |
Total | 8 vote(s) | 100% |
* You voted for this item. | [Show Results] |
The forbidden GOTO
|
04-16-2008, 09:44 AM
Does anyone else use goto to write spaghetti programs like me?
WHILE RPG$ <> "complete" : make up silly excuses :WEND
04-17-2008, 06:42 AM
That's all hogwash really. Goto wouldn't even be there if you weren't supposed to use it! Of course, abuse is another story. A good rule of thumb is don't use goto to move backwards in your program, unless it's just a short hop, if you know what I mean.
04-18-2008, 05:55 AM
I was taught not to use it but I really see no problem with using it.
04-18-2008, 12:16 PM
Using or not using GOTO is an age old debate. Simply put its best to not use it if you can as using it can make your program code a little harder to read but otherwise use it in small doses. Just remember there is usually more than one way to do code something.
one of my spaghetti programs can be downloaded here:
http://practicalqbprogs.googlepages.com/peanuts
WHILE RPG$ <> "complete" : make up silly excuses :WEND
04-22-2008, 10:11 PM
Jack of The Qbasic Station wrote a good article on this a while ago:
http://www.qbasicstation.com/index.php?c=t_article&a=10
-yah
04-23-2008, 11:38 PM
Good reference, Zoasterboy! I'm in agreement with it, too.Â
One instance where I use the GOTO is when I am trouble shooting. I'll enter this at the beginning of the code: Code: TEST = 0 Code: IF TEST = 1 THEN GOTO SKIP1 Code: SKIP1: Once the program runs fine, I either remark out the line, TEST = 1 which allows me to further trouble shoot easily in the future, or, if I'm very sure I will not have to do any more debugging, I will delete both "TEST =" lines, and all the pertinent GOTO... and SKIP1:, SKIP2:, etc. labels.
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
|
« Next Oldest | Next Newest »
|