Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uakari.primate.wisc.edu!zaphod!wuarchive!uunet!icom!xwkg.Icom.Com!andy From: andy@xwkg.Icom.Com (Andrew H. Marrinson) Newsgroups: comp.unix.shell Subject: Re: A new shell. Any takers? Message-ID: Date: 15 Jan 91 18:23:06 GMT References: <11134@helios.TAMU.EDU> <2573@root44.co.uk> Sender: news@icom.icom.com (News Feed) Organization: Icom Systems, Inc. Lines: 37 gwc@root.co.uk (Geoff Clare) writes: >Byron Rakitzis writes: >The worst of the lot is: >>if (command) >> command >>if not >> command >Why on earth use "if not" when "else" is the obvious thing to use? I almost sent email asking this same question. Then I realized why. (At least, I think I realized.) The if not command is not exactly the same as an else. True, in the above example it seems it could be replaced with else to good effect, but consider: if (command) { if (command) command } if not command I suspect the if not applies to the second if, not the first. Naming it else would cause people to expect it to apply to the first if, as an else would. Calling it if not makes it clear it is different from else: it applies to the last if command run, and knows nothing about the lexical structure of the script. Do I get a cookie? -- Andrew H. Marrinson Icom Systems, Inc. Wheeling, IL, USA (andy@icom.icom.com)