how to emulate goto.

From: Gaurav Agarwal (gaurava_at_gmail.com)
Date: 01/31/05


Date: 31 Jan 2005 03:57:53 -0800

Hi,
In a method I intend to do the following:

void foo() {

do_processing;
if (error)
goto exit;

do_more_processing;
if (error)
goto exit;
.
.
.

exit:
return some value;
}

Since I cannot use goto in java I cannot jump to the end of a function.
Also break can only take me to the start of a loop and not to the end
of the loop.
If possible I would not want to embed "return false;" everytime I check
for error.

Any advice?

Gaurav



Relevant Pages