From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25871 invoked from network); 28 Sep 2005 14:55:49 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 28 Sep 2005 14:55:49 -0000 Received: (qmail 54684 invoked from network); 28 Sep 2005 14:55:40 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 28 Sep 2005 14:55:40 -0000 Received: (qmail 8327 invoked by alias); 28 Sep 2005 14:55:34 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9455 Received: (qmail 8316 invoked from network); 28 Sep 2005 14:55:33 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 28 Sep 2005 14:55:33 -0000 Received: (qmail 53776 invoked from network); 28 Sep 2005 14:55:33 -0000 Received: from vms048pub.verizon.net (206.46.252.48) by a.mx.sunsite.dk with SMTP; 28 Sep 2005 14:55:33 -0000 Received: from candle.brasslantern.com ([71.116.81.225]) by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0INJ00L6D84J1AU6@vms048.mailsrvcs.net> for zsh-users@sunsite.dk; Wed, 28 Sep 2005 09:55:32 -0500 (CDT) Received: from candle.brasslantern.com (IDENT:schaefer@localhost [127.0.0.1]) by candle.brasslantern.com (8.12.11/8.12.11) with ESMTP id j8SEtU72024313 for ; Wed, 28 Sep 2005 07:55:30 -0700 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id j8SEtUv5024312 for zsh-users@sunsite.dk; Wed, 28 Sep 2005 07:55:30 -0700 Date: Wed, 28 Sep 2005 14:55:30 +0000 From: Bart Schaefer Subject: Re: Arithmetic expression and TRY_BLOCK_ERROR In-reply-to: <20050928084655.GC1384@DervishD> To: Zsh Users Message-id: <1050928145530.ZM24311@candle.brasslantern.com> MIME-version: 1.0 X-Mailer: Z-Mail (5.0.0 30July97) Content-type: text/plain; charset=us-ascii References: <20050927234153.GB988@DervishD> <4880307205092717115fbb352a@mail.gmail.com> <20050928084655.GC1384@DervishD> Comments: In reply to DervishD "Re: Arithmetic expression and TRY_BLOCK_ERROR" (Sep 28, 10:46am) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 On Sep 28, 10:46am, DervishD wrote: } } 'let variable=0' is shorter ;) I really don't know the reason, } but I can find this kind of assignment everywhere :-/ I suspect it's simply Peter's preference to always use variables in a consistent context, i.e., either in math expressions or out, not some of each. A possible reason for this is future-proofing. Suppose you have: (( variable = 0 )) # or any other integer constant Then later that gets changed to: (( variable = othervariable )) If you had instead written it without the (( )), the meaning of: variable=othervariable is entirely different. Also, some people prefer the readability of being able to put spaces around the "=". However, doing integer/float assignments in math context is marginally more efficient than doing them as plain assignments. In a single command this is probably offset by the overhead of parsing the (( )), but in a loop it could become important, and if you're in the habit of always writing the (( )) you won't forget them where they matter.