Here is an old thread that discusses the "goto" in Java.
-Pushkar
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32611
4
posted
0
Eric Mission, agree. As far as I am concerned, even thinking about "goto" is a logic error.
In fact you can always use a combination of selection repetition and sequence to implement absolutely everything; even your labelled "break" is unnecessary. By the way: it#s not LOOPA but LOOPA:
Eric Mission
Greenhorn
Joined: Apr 22, 2009
Posts: 22
posted
0
By the way: it#s not LOOPA but LOOPA:
Ah! yes it is- Some days I wish forums had compilers built into them so banging out small examples like that could be syntax checked Alas, I would also like to win the lottery...
even your labelled "break" is unnecessary
So very true, though I figured that if someone was posting a question about a GOTO statement in OOP I thought that by presenting the most basic of basic programming methods I could think of may shine some light for him/her, though probably a mute attempt. Not to mention providing an example of using a label as James suggested.
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32611
4
posted
0
Eric Mission wrote:. . . I wish forums had compilers built into them . . .
Just at the moment we are having difficulty with delays for ordinary text, so no chance of a free compiler
I have to challenge this... no C programmer worth his salt should be using the goto statement. I used C for many years, including device drivers, network drivers, kernal code, etc. And I have never used goto... Well, except once, due to time constraints, and I went back and got rid of it. If it was Java, I would have been forced to do it correctly the first time.