Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What does GOTO do?
#41
Quote:
Moneo Wrote:You can probably remove the goto's and structure this code, but you will surely slow it down
This simply isn't true. Try the following code:

Code:
SUB AgaSort (amax AS INTEGER)
....... etc.
END SUB

EDIT: However, there are situations where GOTO's are really useful like:.....
[*]The 1.5-loop problem
......

I inserted your structured version of Aga's code into the SORTDEMO program. Your right, it works, and it runs at the same speed. Of course, the SortDemo program, which sorts 43 records, is not exactly a real system test for any sort algorithm. It just gives you a feeling.

Anyway, you did a very nice job of structuring the code, and you did prove your point.

BTW, what is the 1.5-loop problem?
*****
Reply
#42
Yeah, what IS the 1.5 line loop problem?

Thanks for the accolades..
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#43
Mark: You posted:
Quote:[quote="Moneo"]
EDIT: However, there are situations where GOTO's are really useful like:

1. Exiting from multiple nested loops of the same kind (see the example above)
2. The 1.5-loop problem[/list]
Mark

so, I am also asking, "What does the 1.5-loop problem consist of?"
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply
#44
Quote:The 1.5 loop problem is when a problems solution requires to exit the loop in the middle of the loop and not at the beginning or the end of it.
Helps to read sometimes... Wink
Reply
#45
Yes, we read and forget that we have read...after all, memory is so volatile...

But, thank you for posting what Mark wrote, so we could understand the "1.5 solution"! I guess that, if it loops three times and then exits before reaching the end, it would be called the "n and a half solution"? Ha, ha, just trying to be "logical".
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply
#46
ive nvr used a goto, dont find em useful
Reply
#47
This topic is 4 months old..
Reply
#48
I'm gonna make a website which collects all the threads about this topic that have been posted in this forum since I first came here.

I think I'll have to buy a dedicated server or something :lol:

I think that it was Agamemnus who said that "GOTO is like chocolate". It's one of the best metaphors I've ever read.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#49
lol, i guess GOTO is like chocolate, it's addictive to use but is best used in modertion
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)