Page 1 of 1
Break an IF Statement
Posted: Thu May 01, 2008 10:20 am
by AliasBDI
Is it possible to break out of an IF statement like this ...
Code: Select all
if (condition) {
if (condtion) {
//break out to first conditions else...
}
} else {
//do this..
}
Re: Break an IF Statement
Posted: Thu May 01, 2008 10:30 am
by lafever
What are you using this for? Are there reasons to not using elseif? If an if statement returns false it's just ignored anyways.
Re: Break an IF Statement
Posted: Thu May 01, 2008 10:31 am
by Christopher
There is no breaking out in the sense of a loop, but you can certainly construct the logic to control what is done, and not done, under specific conditions:
Code: Select all
if (condition1) {
if (condtion2) {
// code that meets both condition1 and condition2 will run here
}
} else {
//do this if not condition1, but still could be condition2
}