Is a steaming pile of crap. Next time I'm working with C++ I'll suddenly start typing in some Lisp shall I, and see how it goes. Then I'll whinge to Microsoft because their C++ compiler doesn't support Lisp, right?
Erm, what part of "style" did you not understand? Style is preference in methods to do something, within the reasonable framework of the compiler.it is unreasonable that goto should be restricted in this way, although, according to skid there are some internal complications. The whole challenge of programming is to work within the constraints of the language, which the compiler adheres to. If there was no challenge involved we wouldn't need programmers and there wouldn't really be programming "languages".
Only for noobs. The challenge and point of programming is to define specificly how to do a task. The challenge is nto working within the constraints, it is rigourously defining how to do something, without error. And John Pickford is right, Exit[n] IS horrible.
Exit [n] is not.One option is to set a flag, and check it in each loop you want to exit. not only is this even more cryptic than doing an exit [n], but requires alot mroe processing. Another is throw. I'm not sure how much processing it takes, but concider this with exit [n]:
For a=0 To 100 For Local b=0 To 100 If b=10 Then Exit 2 Next For Local c=0 To 100 If c=10 Then Exit Next NextNot a practical example, but you get the idea.
The Function one is prolly the best, but there's still the function calling overhead. And then you can't use the local vars, unless you pass them ByRef. Its all ugly. Except Exit [n].
BTW, MrCredo-
Perturbatio - your code is a joke. who write such unreadable codes? this is not a alternative for goto - this is only a workaround. goto was "designed" for such codes, to eliminate creating tmp-variables. A function is also a workaround. Not existing goto in strict mode is a problem.
No, goto is a remnant from previous basics that happens to be useful for exiting loops.Also, YOUR code is a joke:
WHILE dummy #again FOR i=... FOR j=... REPEAT IF xyz=1 THEN goto again FOREVER NEXT NEXT WENDWho write such unreadable code? Its not even indented. And all the commands are in caps.
[EDIT]Cross post - craig, thats actually a rather good method. The only problem is that the code after the end of the current loop, inside the loops you are exiting will execute an extra time:
For Local i=0 To 100 For Local a=0 To 100 If a=20 Then a=1000 i=1000 Exit EndIf Print a Next Print i Next
Exit [n] is still better :)