Re: GoTo in Java
- From: Peter Lacey <lacey@xxxxxxx>
- Date: Tue, 17 Jan 2006 17:53:34 -0600
Howard Brazee wrote:
>
> It is interesting that Java, where the word GOTO is reserved but not
> used, it has a label and a GoTo equivalent to tell us how to exit a
> multi-layer iteration (perform loop).
>
> I wish we had an equivalent in CoBOL.
We do, dammit (if I undersrand what you're saying). GOTO, GOTO
equivalent - what's the point? GOTO works, does just what an equivalent
would do. Stop being stubborn.
(Cancel this if you're trolling).
.
Relevant Pages
- Re: Using "break" to Break Out of Multiple Loops in One Call
... The main difference I see is that the syntax of the Java labeled break reinforces the idea of a structured flow. ... It's true that you can add braces to force an equivalence to a goto, but when you do so the language is giving you very loud clues about whether ... I prefer to believe that I never misuse a "goto" statement, but whether I do or not, it's my belief that the Java syntax would make it a lot more obvious to me if I'd abused the statement. ... Granted, I don't know what the Java designers were actually thinking, but I like to think that's at least part of why it's the way it is. ... (microsoft.public.dotnet.languages.csharp) - Re: Would like a preprocessor.
... > This will probably blown your mind but I would kill for a GOTO ... whay are you writing in Java in the first place? ... > decided to try straight java first. ... (comp.lang.java.programmer) - Re: Would like a preprocessor.
... >> I hate to tell you this, but Java actually does have a GOTO (not under ... It is not a goto. ... The Java break can in fact be used to go to an arbitrary label. ... (comp.lang.java.programmer) - Re: Would like a preprocessor.
... >> This will probably blown your mind but I would kill for a GOTO ... > I hate to tell you this, but Java actually does have a GOTO (not under ... >> I considered writing this class in JASMINE the bytecode assembler but ... >> decided to try straight java first. ... (comp.lang.java.programmer) - Re: How would you do this?
... But, as I've said before, I don't actually think that a "goto" statement is something to be avoided in and of itself. ... Interestingly, in Java there is no "goto" statement and the "break" and "continue" statements are specifically designed to allow for this kind of scenario. ... Similarly, the "continue" statement can continue a labeled loop block, rather than just the inner-most one. ... This forces the programmer to be explicit about falling through to the next switch, allowing the compiler to emit an error if they aren't. ... (microsoft.public.dotnet.languages.csharp) |
|