Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #6228

Re: Back to Basics - IF statements

From Kaz Kylheku <kaz@kylheku.com>
Newsgroups comp.programming
Subject Re: Back to Basics - IF statements
Date 2016-01-18 23:29 +0000
Organization Aioe.org NNTP Server
Message-ID <20160118152028.508@kylheku.com> (permalink)
References <5fb53de5-a057-493f-b58c-5c99572513aa@googlegroups.com> <n7ivv5$6cq$2@dont-email.me>

Show all headers | View raw


On 2016-01-18, Richard Heathfield <rjh@cpax.org.uk> 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

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Back to Basics - IF statements mack.altmaniii@gmail.com - 2016-01-18 07:18 -0800
  Re: Back to Basics - IF statements Richard Heathfield <rjh@cpax.org.uk> - 2016-01-18 15:24 +0000
    Re: Back to Basics - IF statements Kaz Kylheku <kaz@kylheku.com> - 2016-01-18 23:29 +0000
    Re: Back to Basics - IF statements LinuxNext <nobody@nospam.net> - 2016-01-18 20:34 -0800
      Re: Back to Basics - IF statements Richard Heathfield <rjh@cpax.org.uk> - 2016-01-19 07:14 +0000
        Re: Back to Basics - IF statements Jim Lee_0 <jlee54@gmail.com> - 2016-01-21 00:44 -0800
          Re: Back to Basics - IF statements Öö Tiib <ootiib@hot.ee> - 2016-01-21 08:53 -0800
  Re: Back to Basics - IF statements John McCue <jmccue@jmcnet1.bstnma.east.verizon.net> - 2016-01-18 22:26 +0000
    Re: Back to Basics - IF statements Richard Heathfield <rjh@cpax.org.uk> - 2016-01-18 22:33 +0000
  Re: Back to Basics - IF statements BartC <bc@freeuk.com> - 2016-01-19 13:11 +0000

csiph-web