home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!umn.edu!cybrspc!roy
- From: roy%cybrspc@cs.umn.edu (Roy M. Silvernail)
- Newsgroups: comp.lang.c
- Subject: Re: The Correct Way To Write C if-Statements
- Message-ID: <c6ZkuB5w165w@cybrspc.UUCP>
- Date: Sat, 21 Nov 92 02:59:11 CST
- References: <1992Nov20.093957@gese.ge14.mdadv.gv.at>
- Organization: Villa CyberSpace, Minneapolis, MN
- Lines: 48
-
- sca@gese.ge14.mdadv.gv.at (Petzi Schweda) writes:
-
- > think you'll end up a little bit messy when using this one inside blocks:
- >
- > for (...)
- > {
- > if (cond)
- > {
- > state;
- > }
- > else
- > {
- > state2;
- > }
- > }
- >
- > too much paranthesis in this column, for my taste ...
-
- Yuk! OK, the original article notwithstanding, what's wrong with this?
-
- for (...) {
- if (cond) {
- state;
- } else {
- state2;
- }
- }
-
- I've also been known to do this...
-
- for (...) {
- if (cond) {
- state;
- } else
- if (other_cond) {
- state2;
- } else
- if (yet_another_cond) {
- state3;
- }
- }
-
- This makes it easy to add (yet_one_more_last_minute_condition) without
- having to decode brace placement.
- --
- Roy M. Silvernail -- [my machine ] "Sometimes, you're the windshield....
- roy%cybrspc@cs.umn.edu [my opinions] sometimes, you're the bug!"
- cybrspc!roy@cs.umn.edu [my $0.0275 ] --Mark Knopfler
-