
Your round, Pupil!
agree 100%Pupil wrote:Most anything you need to use Gosub for can easily be replaced by a procedure which imho improves readabillity alot. However on the subject of GOTO, i can't really understand all the rabid goto haters, you've been brainwashed by your teachersIf you avoid goto at all cost you should logically avoid Break and Continue as well, because they're just Goto's in disguise
A very good point!!!jack wrote:agree 100%Pupil wrote:Most anything you need to use Gosub for can easily be replaced by a procedure which imho improves readabillity alot. However on the subject of GOTO, i can't really understand all the rabid goto haters, you've been brainwashed by your teachersIf you avoid goto at all cost you should logically avoid Break and Continue as well, because they're just Goto's in disguise
I don't agreePupil wrote:If you avoid goto at all cost you should logically avoid Break and Continue as well, because they're just Goto's in disguise
Code: Select all
ForEach(Person())
If Person()\Name = "Timmy"
MessageRequestor("Yeah!","Timmy was found!")
Break ; <-- We need a sexy break here because we found Timmy and we can stop searching now!
EndIf
Next
I believe you just missed the point.Joakim Christiansen wrote:I don't agreePupil wrote:If you avoid goto at all cost you should logically avoid Break and Continue as well, because they're just Goto's in disguise
If you avoid break and continue it would just make your code slow and stupid![]()
Code: Select all
ForEach(Person()) If Person()\Name = "Timmy" MessageRequestor("Yeah!","Timmy was found!") Break ; <-- We need a sexy break here because we found Timmy and we can stop searching now! EndIf Next
I strongly disagree, your logic is somewhat lacking, why? -Because you explicitly tell to which label you will go with a GOTO so it's not undefined or badly defined, it's the opposite, it's clearly defined as is the case with break and continue.Hades wrote: But IMO Break and Continue are very different to Goto. It is clearly defined where they go. They are part of a loop, Select or something like that.
No, thats not what i'm saying(i do realize that this might not be directly aimed at me, but i'll aswer anywayHades wrote: In every control structure (If, Repeat, While...) in ASM, there is at least one jump to a label, like with Goto. So you want to say because of that it's all the same?
I agree that the scope is one thing that makes them different.Hades wrote: With Goto you can jump everywhere without limits. That's the difference. And that makes the code hard to read and maintain.
Code: Select all
ForEach(Person())
If Person()\Name = "Timmy"
MessageRequestor("Yeah!","Timmy was found!")
Goto lbl_endsearch ; <-- We need a sexy break here because we found Timmy and we can stop searching now!
EndIf
Next
lbl_endsearch:
Just saying -you use GOTO ergo you're coding style is bad- is a bit to simple, it's like saying -your shirt is wrinkly, your home must be very untidy- (That's about the same leap of assumtion that you doHades wrote:Sure, the Goto will go to the label. Would be a bit difficult do write a program if it would go where it wants to. :roll:
But where is that label? You have to search for it. Easy for a few lines, horrible for a big project.
I've learned Basic on a VC20 in the early 80s. So I was coding with Goto's and Gosub's for many years. But I'm happy it's a thing of the past (at least for me).
I have no problem with you using Goto and Gosub. Do what you like. But it doesn't make it good coding style.