No problemblueznl wrote: Luis, now I disagree![]()

I don't think so.blueznl wrote: You see, Goto is evil![]()
I agree. Or better: there is no often need for the goto.blueznl wrote: Seriously, there's little need for Goto.
It's fine. I know you can do what you have explained, I wrote about that myself. I simply don't like it, I find it clumsy, bad to read and worst to maintain (error prone).Thus far, I've never ever felt the need for Goto.
Moreover, your code must continually check if it's right for him to do what it's supposed to do.
Imagine a fairly long procedure, calling apis who can fail, doing disk i/o who can fail, doing memory allocation who can fail. When a call of the above fails, there is no point in continue, you should exit returning some informative code.
Using the "goto" (try/catch) approach, you can write all the code supposing it will actually work. No tests, flags, breaks, or whatever trying to transfer the information that something went wrong from a level to another.
When something go bad, you simply leave the proc jumping to a common exit point, where you can gracefully exit closing file, deallocating memory and so on.
The resulting code is easier to follow, the linear sequence from up to down (when all is going as it supposed to go) is free from the burden of testing unneeded flags, the exit point deal with the rest.
Using some macros you can "hidden" the actual gotos from the eyes of sensitive people, like all the languages in the end do. Break is a goto. Continue is a goto. Exceptions handling is a sophisticate form of goto.
Anyway, no need to repeat myself, so:
http://www.purebasic.fr/english/viewtop ... 32#p310632
http://www.purebasic.fr/english/viewtop ... 92#p310692