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


Groups > comp.lang.javascript > #37448

Re: A proposition for a conditional loop.

Path csiph.com!aioe.org!.POSTED.wIgm+2MIUUYkuZKIR0Uhug.user.gioia.aioe.org!not-for-mail
From "R.Wieser" <address@not.available>
Newsgroups comp.lang.javascript
Subject Re: A proposition for a conditional loop.
Date Sat, 28 Sep 2019 17:28:38 +0200
Organization Aioe.org NNTP Server
Lines 121
Message-ID <qmnu7f$1bdg$1@gioia.aioe.org> (permalink)
References <eivmoeptedold0agjpuptcne37buqvitb3@4ax.com> <deeecb37-bca4-46bb-b6d2-6df0dcc36154@googlegroups.com> <6e38ab46-bf8d-4422-9491-75019cc471fd@googlegroups.com> <opbnoehqhmp41995chha6a7oemqm29l5n7@4ax.com> <9ee6c578-f5be-4d6c-97ca-dc63379641f6@googlegroups.com> <jb2poe91vl5456rop6okfmjnu2mm39f22k@4ax.com> <47bf83ce-1de3-4b9b-97bc-386d7b306f0a@googlegroups.com> <utrpoedg7h1h2f334r8irhkgjqf413cft0@4ax.com> <95dfed9c-f232-43d4-aa54-267e5fa87115@googlegroups.com> <76kroehhtucq3t3v7s7ogtve762f1sf9eo@4ax.com> <aa338903-0be3-4046-bdf0-866919d78d0b@googlegroups.com> <b8239d35-09e9-4940-a877-ef39e7f29d34@googlegroups.com> <87lfu9r1an.fsf@bsb.me.uk> <90de6262-942e-4ece-abcc-299b47f1a4c7@googlegroups.com> <87ftkhqwko.fsf@bsb.me.uk> <6ff0b61e-41d6-4f04-9ef9-b15b102be6b2@googlegroups.com> <87a7apqqid.fsf@bsb.me.uk> <cd85b67b-7400-4f49-b3aa-c71f517437f5@googlegroups.com>
NNTP-Posting-Host wIgm+2MIUUYkuZKIR0Uhug.user.gioia.aioe.org
X-Complaints-To abuse@aioe.org
X-Notice Filtered by postfilter v. 0.9.2
X-MSMail-Priority Normal
X-Priority 3
X-RFC2646 Format=Flowed; Original
X-Newsreader Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE Produced By Microsoft MimeOLE V6.00.2900.5512
Xref csiph.com comp.lang.javascript:37448

Show key headers only | View raw


Jonas,

> Well i really want to know because, maybe it is me that do not get it?

Yes, its you.  Definitily.   Multiple people have tried to explain, and in 
multiple ways.

> If i am doing something unnecessary or really stupid of course i
> want to know.

I tried to help you understand, but you refused to help me understand what 
you where actually after.   No matter what I asked from you, you 
refused/ignored it.   And no questions back asking for clarification of what 
I asked for either. :-(


Even now you are throwing big blobs of - fully unrelated to the problem ! - 
comparisions and code into your messages, and expect us to dig thru it. 
Thats not how its done I'm afraid.  For multiple reasons.

One of them is that in the process of trimming of your question and/or 
examples of al the superfluous stuff you will often find the answer 
yourself.

The below is an impression of what I /think/ you might have been after, but 
as you bluntly refused to provide any specifics I could easily be wrong :

do {
   code1
} until (condition1, condition2} then {
  code2
}

MIND YOU: This is NOT valid JS !

In the above code1 should execute until either condition1 or contition2 is 
true, and code2 should only execute when condition2 is true.

If that is so than the above would be the frankenchild of that "do until" 
and "if" you are after.

Also, you already have posted code which does what you want, and several 
examples where posted that /also/ do what you want.   And I've, again, not 
seen anything explaining to why those code examples where not good enough 
for you. :-(

And by the way: why stop with just /one/ extra loop condition ?    Why not 
go for any abitrary larger number ?   I mean, maybe there are multiple 
things you could be searching for, each with its own block of code that 
needs to be executed for it ?     You know, like this:

do {
   code1
} until (condition1, condition2, condition3, condition4 , ...} then {
  code2
}then {
  code3
}then {
  code4
} ...

MIND YOU: This isn't valid JS either.

Same here, code2 is only executed when condition2 is true, code3 is only 
executed when condition3 is true, etc.


Or maybe, just /maybe/ using of what JS already has combined with the code 
you posted in your message of 25/09 15:10 (though I've removed the cruft) 
would be enough :

i = 1;
while(i < 5) {
  if (condition2) {
     code2;
     break;
  }elseif (condition3) {
     code3;
     break;
  }elseif (condition4) {
     code4;
     break;
  }
  i++;
}

Remark: in the above "i < 5" equals "condition1", and "i++" equals "code1", 
as in the (non-working!) example above it.

Notice how simple this code looks ?   Even with multiple conditions that all 
exit the loop ?    This actually works (if you put actual conditions and 
code into it ofcourse).

And yes, it could become looking ugly with all your actual comparisions and 
code plugged into it (and just maybe /that/ is what your problem is all 
about ...).  Thats not to be helped - though you could put some 
strategically placed blank, or even comment lines into it, visually grouping 
conditions and following codeblocks.

Remark: The above "while" loop could also be done with a "for" loop (would 
probably even look better).


And even though the above (non-working and/or working examples) might not be 
/exactly/ what you where after or thinking of, it should be a hint to what 
your posted examples should look like - together with an explanation 
ofcourse.

***** Helping is a two-way street ! *****

To enable us to help you you will need to help us understand the problem you 
have.   If you cannot do that you should first sit back and think about the 
problem description itself.  Without it everything becomes guesswork - on 
both your and our sides.    And for us that becomes old very fast. (as you 
might have noticed, I'm not the only one who got irritated by the lack of 
clear language).

Regards,
Rudy Wieser

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


Thread

A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-23 00:55 -0700
  Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-23 01:05 -0700
    Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-23 01:14 -0700
      Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-23 01:16 -0700
        Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-24 05:12 -0700
  Re: A proposition for a conditional loop. "R.Wieser" <address@not.available> - 2019-09-24 22:27 +0200
    Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-24 22:39 -0700
      Re: A proposition for a conditional loop. "R.Wieser" <address@not.available> - 2019-09-25 09:05 +0200
        Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-25 02:47 -0700
          Re: A proposition for a conditional loop. "R.Wieser" <address@not.available> - 2019-09-25 13:13 +0200
            Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-25 05:13 -0700
              Re: A proposition for a conditional loop. "R.Wieser" <address@not.available> - 2019-09-25 15:04 +0200
                Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-25 06:10 -0700
                Re: A proposition for a conditional loop. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-09-25 15:50 +0100
                Re: A proposition for a conditional loop. Tim Streater <timstreater@greenbee.net> - 2019-09-25 16:00 +0100
                Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-25 10:20 -0700
                Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-25 10:26 -0700
                Re: A proposition for a conditional loop. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-09-25 19:18 +0100
                Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-25 12:19 -0700
                Re: A proposition for a conditional loop. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-09-26 10:48 +0100
                Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-26 04:38 -0700
                Re: A proposition for a conditional loop. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-09-26 18:05 +0100
                Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-26 10:54 -0700
                Re: A proposition for a conditional loop. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-09-27 10:06 +0100
                Re: A proposition for a conditional loop. dr.j.r.stockton@gmail.com - 2019-09-27 02:34 -0700
                Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-27 05:32 -0700
                Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-27 05:36 -0700
                Re: A proposition for a conditional loop. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-09-27 20:23 +0100
                Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-27 12:45 -0700
                Re: A proposition for a conditional loop. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-09-27 22:05 +0100
                Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-27 14:39 -0700
                Re: A proposition for a conditional loop. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-09-28 00:16 +0100
                Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-27 17:10 -0700
                Re: A proposition for a conditional loop. "R.Wieser" <address@not.available> - 2019-09-28 17:28 +0200
                Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-28 11:34 -0700
                Re: A proposition for a conditional loop. "R.Wieser" <address@not.available> - 2019-09-28 22:23 +0200
                Re: A proposition for a conditional loop. Tim Streater <timstreater@greenbee.net> - 2019-09-28 21:42 +0100
                Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-29 07:40 -0700
                Re: A proposition for a conditional loop. "R.Wieser" <address@not.available> - 2019-09-29 18:33 +0200
                Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-29 09:58 -0700
                Re: A proposition for a conditional loop. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-09-29 19:18 +0100
                Re: A proposition for a conditional loop. "R.Wieser" <address@not.available> - 2019-09-29 21:02 +0200
                Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-29 13:54 -0700
                Re: A proposition for a conditional loop. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-09-28 10:41 +0100
                Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-27 13:17 -0700
                Re: A proposition for a conditional loop. Tim Streater <timstreater@greenbee.net> - 2019-09-27 13:41 +0100
                Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-27 06:01 -0700
                Re: A proposition for a conditional loop. Tim Streater <timstreater@greenbee.net> - 2019-09-27 14:03 +0100
                Re: A proposition for a conditional loop. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-09-27 19:23 +0100
                Re: A proposition for a conditional loop. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-27 12:06 -0700
                Re: A proposition for a conditional loop. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-09-28 14:43 +0100
                Re: A proposition for a conditional loop. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-09-25 21:47 +0100
                Re: A proposition for a conditional loop. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-09-26 10:49 +0100
                Re: A proposition for a conditional loop. "R.Wieser" <address@not.available> - 2019-09-25 17:07 +0200

csiph-web