Qbasicnews.com

Full Version: What does GOTO do?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
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?
*****
Yeah, what IS the 1.5 line loop problem?

Thanks for the accolades..
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?"
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
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".
ive nvr used a goto, dont find em useful
This topic is 4 months old..
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.
lol, i guess GOTO is like chocolate, it's addictive to use but is best used in modertion
Pages: 1 2 3 4 5