Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What method to break to a specific location?

Status
Not open for further replies.

BobMCT

IS-IT--Management
Sep 11, 2000
756
US
Gentlemen;
I have a logic structure that contains multiple nested structures. All works well. Now, however, I have a situation where when a certain condition is true in one structure, the logic should reset several variables then break but resume execution within another/different logic structure.

As an example, in perl, one could label the structure blocks (i.e.: _name:) then in lieu of break use "last _name" and the logic would immediate exit to the end of the structure with the name referenced and resume from there.

In other languages, perhaps one could use a goto like command but those are not available I believe in php.

So, I am asking/looking for ideas/examples of how other may accomplish this feat? Please provide some ideas, suggestions, etc?

Thanks
Bob
 
will nested functions not do it for you? you can exit those functions with a "return" directive.

you can use the "break int" command from nested loops which might help too (the int is the number of nests you want to break back from).

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top