Path: csiph.com!aioe.org!.POSTED!not-for-mail From: Kaz Kylheku Newsgroups: comp.programming Subject: Re: Back to Basics - IF statements Date: Mon, 18 Jan 2016 23:29:40 +0000 (UTC) Organization: Aioe.org NNTP Server Lines: 30 Message-ID: <20160118152028.508@kylheku.com> References: <5fb53de5-a057-493f-b58c-5c99572513aa@googlegroups.com> NNTP-Posting-Host: OGJi3KNpFOhM58UHZwXj0w.user.gioia.aioe.org X-Complaints-To: abuse@aioe.org User-Agent: slrn/pre1.0.0-18 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.programming:6228 On 2016-01-18, Richard Heathfield wrote: > On 18/01/16 15:18, mack.altmaniii@gmail.com wrote: >> if (id = 1) { >> set $piece(^|"app"|global("index"),"^",1)=$horolog >> } elseif (id = 2) { >> set $piece(^|"app"|global("index"),"^",3)=$horolog >> } elseif (id = 3) { >> set $piece(^|"app"|global("index"),"^",5)=$horolog >> } elseif (id = 4) { >> set $piece(^|"app"|global("index"),"^",7)=$horolog >> } elseif (id = 5) { >> set $piece(^|"app"|global("index"),"^",9)=$horolog >> } > > set $piece(^|"app"|global("index"),"^",id * 2 - 1) = $horolog Unfortunately, you've erased all traces of humor inherent in the original. The goal is to deliver the punchline without boring the audience. The following howler makes essentially the same gag, without the verbose repetition of similar code: for (i = 1; i <= 5; i++) { // replace with loop syntax for language if (id = i) set $piece(^|"app"|global("index"),"^", i * 2 - 1) = $horolog } T