Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > 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
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