home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!uunet.ca!geac!alias!news
- From: Reid Ellis <rae@Alias.com>
- Subject: Re: named loops
- Message-ID: <1992Aug21.143653.10805@alias.com>
- Sender: news@alias.com (News Owner)
- Organization: Alias Research, Inc., Toronto ON Canada
- References: <aldavi01.714376080@starbase.spd.louisville.edu>
- Date: Fri, 21 Aug 1992 14:36:53 GMT
- Lines: 34
-
- Arlie Davis <aldavi01@starbase.spd.louisville.edu> writes:
- |for main_loop (...)
- | // ...
- | for inner_loop (...)
- | // ... complex mess of loops ...
- | break main_loop; // somewhere deep inside the loops
- | // ...
- | continue inner_loop; // similarly, deep inside loops
-
- How about an int argument to "break", as supported in many scripting
- languages? Add a similar argument to "continue" while we're at it.
- Then you can do things like this:
-
- for(...) { // loop outer
- for(...) { // loop middle
- for(...) { // loop inner
-
- break; // breaks out of inner
-
- break 2; // breaks out of middle
-
- continue 2; // continues middle
- } // loop 3
- } // loop 2
- } // loop 1
-
- An argument of zero or one would cause the current, default behaviour.
- Just a thought...
-
- Reid
- --
- Reid Ellis
- rae@utcs.utoronto.ca || rae@Alias.com
- CDA0610@applelink.apple.com || +1 416 362 9181 [work]
-