Do Until Loop

S

shannon

Hello,
I am wondering if a Do until loop can be used in Javascript. I have an
array and want to fill the array 10 times with the users details until
it reaches 10 or if they press cancel. I'm using window.prompt to get
user info. Any suggestions.

Do {
//ask user to input their details
} while (myairline !=10);
 
E

Evertjan.

shannon wrote on 25 nov 2005 in comp.lang.javascript:
Hello,
I am wondering if a Do until loop can be used in Javascript. I have an
array and want to fill the array 10 times with the users details until
it reaches 10 or if they press cancel. I'm using window.prompt to get
user info. Any suggestions.

Do {
//ask user to input their details
} while (myairline !=10);

no
 
T

Thomas 'PointedEars' Lahn

shannon said:
Do {
//ask user to input their details
} while (myairline !=10);

JS ist case-sensitive. `do' instead of `Do' works OK.
Learn from this:

var i = 10;

do
{
alert(i);
}
while (--i);


PointedEars
 
E

Evertjan.

Thomas 'PointedEars' Lahn wrote on 25 nov 2005 in comp.lang.javascript:
JS ist case-sensitive. `do' instead of `Do' works OK.
Learn from this:

var i = 10;

do
{
alert(i);
}
while (--i);

do
alert('only once')
while (false);

Very useful!
 
T

Thomas 'PointedEars' Lahn

Evertjan. said:
Thomas 'PointedEars' Lahn wrote on 25 nov 2005 in comp.lang.javascript:

do
alert('only once')
while (false);

Very useful!

What are you talking about? The above loop will be executed exactly 10
times. And if you are referring to the condition: any while-condition
can be _literally_ inverted to an until-condition:

do
alert('as long as condition applies')
while (condition);

do
alert('until condition applies')
while (!condition);


PointedEars
 
T

Thomas 'PointedEars' Lahn

[My previous posting containde pseudo-code, I wanted to post script code]

Evertjan. said:
Thomas 'PointedEars' Lahn wrote on 25 nov 2005 in comp.lang.javascript:

do
alert('only once')
while (false);

Very useful!

What are you talking about? The above loop will be executed exactly 10
times. And if you are referring to the condition: any while-condition
can be _literally_ inverted to an until-condition:

do
{
alert('as long as condition applies')
}
while (condition);

do
{
alert('until condition applies')
}
while (!condition);


PointedEars
 
R

Randy Webb

Thomas 'PointedEars' Lahn said the following on 11/25/2005 4:46 PM:
[My previous posting containde pseudo-code, I wanted to post script code]

Then why didn't you post script code this time? The code itself is
exactly the same.

When correcting yourself, you should reply to yourself.

Top-posting is *never* acceptable. Even when correcting oneself.
 
E

Evertjan.

Thomas 'PointedEars' Lahn wrote on 25 nov 2005 in comp.lang.javascript:
What are you talking about?

Hi, Thomas, I was not referring to your code.

Just making a joke as such.
 
T

Thomas 'PointedEars' Lahn

Randy said:
Thomas 'PointedEars' Lahn said the following on 11/25/2005 4:46 PM:
[My previous posting containde pseudo-code, I wanted to post script code]

Then why didn't you post script code this time?

I did, read again.
The code itself is exactly the same.

It is not, read again.
When correcting yourself, you should reply to yourself.

No, you should not. There are three prudent ways when this happens
(I think we agree that it should not happen in the first place.)

A) Supersede the article to be corrected so that the new article
will be posted and the old article be canceled automatically
by the news server because of the Supersedes header it contains,
specifying the old article via its Message-ID.

B) Cancel the old article and repost it. Virtually the same as A),
however it is supported by news servers that support the Cancel
control message and not the Supersedes header. (However, both
are specified in Son-of-RFC-1036, the quasi-standard Usenet is
based on.)

C) Reply to the erroneous article. Only necessary on very large
postings where little is to be corrected and a complete repost
would waste bandwidth. Since the advent of Usenet spam, there
should not be one _public_ news server or Web interface out
there that disregards Cancel control messages, even though they
are only part of the quasi-standard.

I did A), using my newsreader's built-in feature that works perfectly
since the old article was indeed canceled. What is your excuse?
Top-posting is *never* acceptable. Even when correcting oneself.

I was _not_ top-posting, read again! And learn to understand the
concept of submitter's note, unless you want to make a complete
fool of yourself here.


PointedEars
 
R

Robi

shannon wrote in message news:[email protected]...
Hello,
I am wondering if a Do until loop can be used in Javascript. I have an
array and want to fill the array 10 times with the users details until
it reaches 10 or if they press cancel. I'm using window.prompt to get
user info. Any suggestions.

Do {
//ask user to input their details
} while (myairline !=10);

this works for me:

do
{
details[myairline]=prompt("Enter details for Airline "+myairline);
myairline++;
}
while(myairline<10);
 
R

Randy Webb

Thomas 'PointedHead' Lahn said the following on 11/25/2005 5:54 PM:
Randy Webb wrote:

Thomas 'PointedEars' Lahn said the following on 11/25/2005 4:46 PM:
[My previous posting containde pseudo-code, I wanted to post script code]

Then why didn't you post script code this time?


I did, read again.

The code itself is exactly the same.


It is not, read again.

Ahh yes, the brackets are in the second. Hmmm, condition is undefined.
No, you should not. There are three prudent ways when this happens
(I think we agree that it should not happen in the first place.)

A) Supersede the article to be corrected so that the new article
will be posted and the old article be canceled automatically
by the news server because of the Supersedes header it contains,
specifying the old article via its Message-ID.

Theory: A post will be cancelled when it is Superseded.
Reality: It doesn't happen that way.
B) Cancel the old article and repost it. Virtually the same as A),
however it is supported by news servers that support the Cancel
control message and not the Supersedes header. (However, both
are specified in Son-of-RFC-1036, the quasi-standard Usenet is
based on.)

Theory: A post will be cancelled when it is Cancelled.
Reality: It doesn't happen that way.
C) Reply to the erroneous article. Only necessary on very large
postings where little is to be corrected and a complete repost
would waste bandwidth. Since the advent of Usenet spam, there
should not be one _public_ news server or Web interface out
there that disregards Cancel control messages, even though they
are only part of the quasi-standard.

C) Is the best option, even though you failed to realize it.
I did A), using my newsreader's built-in feature that works perfectly
since the old article was indeed canceled. What is your excuse?

It was cancelled? Then how do you suppose I read it? Are you saying I
have ESP? Yippeeeeeee.

BULLSHIT.

<URL:
http://groups.google.com/group/comp...homas+Lahn+Randy+Webb&rnum=1#80cc4f20ec68b6e6
Theory: Thomas's warped view of the world.
Reality: You are wrong.
I was _not_ top-posting, read again!

You should learn what top-posting is.
Let me quote the wikipedia that you seem to be so fond of:

<quote cite="http://en.wikipedia.org/wiki/Top_posting">
Top-posting means replying to a message above the original message.
</quote>

Well guess what? The very first line of your post was new content. That
is top_posting you moron. Learn the difference.
And learn to understand the concept of submitter's note,
unless you want to make a complete fool of yourself here.

I have been attacked by a lot better than you, so take your best shot.
PointedHead

Take your mistakes with a grain of salt like everybody else.
 
P

Paul

Randy said:
Thomas 'PointedHead' Lahn said the following on 11/25/2005 5:54 PM:
Randy Webb wrote:

Thomas 'PointedEars' Lahn said the following on 11/25/2005 4:46 PM:

[My previous posting containde pseudo-code, I wanted to post script code]

Then why didn't you post script code this time?


I did, read again.

The code itself is exactly the same.


It is not, read again.

Ahh yes, the brackets are in the second. Hmmm, condition is undefined.
No, you should not. There are three prudent ways when this happens
(I think we agree that it should not happen in the first place.)

A) Supersede the article to be corrected so that the new article
will be posted and the old article be canceled automatically
by the news server because of the Supersedes header it contains,
specifying the old article via its Message-ID.

Theory: A post will be cancelled when it is Superseded.
Reality: It doesn't happen that way.
B) Cancel the old article and repost it. Virtually the same as A),
however it is supported by news servers that support the Cancel
control message and not the Supersedes header. (However, both
are specified in Son-of-RFC-1036, the quasi-standard Usenet is
based on.)

Theory: A post will be cancelled when it is Cancelled.
Reality: It doesn't happen that way.
C) Reply to the erroneous article. Only necessary on very large
postings where little is to be corrected and a complete repost
would waste bandwidth. Since the advent of Usenet spam, there
should not be one _public_ news server or Web interface out
there that disregards Cancel control messages, even though they
are only part of the quasi-standard.

C) Is the best option, even though you failed to realize it.
I did A), using my newsreader's built-in feature that works perfectly
since the old article was indeed canceled. What is your excuse?

It was cancelled? Then how do you suppose I read it? Are you saying I
have ESP? Yippeeeeeee.

BULLSHIT.

<URL:
http://groups.google.com/group/comp...homas+Lahn+Randy+Webb&rnum=1#80cc4f20ec68b6e6
Theory: Thomas's warped view of the world.
Reality: You are wrong.
I was _not_ top-posting, read again!

You should learn what top-posting is.
Let me quote the wikipedia that you seem to be so fond of:

<quote cite="http://en.wikipedia.org/wiki/Top_posting">
Top-posting means replying to a message above the original message.
</quote>

Well guess what? The very first line of your post was new content. That
is top_posting you moron. Learn the difference.
And learn to understand the concept of submitter's note,
unless you want to make a complete fool of yourself here.

I have been attacked by a lot better than you, so take your best shot.
PointedHead

Take your mistakes with a grain of salt like everybody else.
 
P

Paul

Well, call me old-fashioned, but I don't think I like the sound of
people who gratuitously term others 'morons'.
We are all learning here, and how little you understand if all you are
capable of is abusing people.
Keep me posted.
Paul Mason
 
L

Lee

Paul said:
Well, call me old-fashioned, but I don't think I like the sound of
people who gratuitously term others 'morons'.
We are all learning here, and how little you understand if all you are
capable of is abusing people.

I give up. Who are you talking to?
Please quote the significant part of posts that you respond to.
 
P

Paul

Lee said:
Paul said:

I give up. Who are you talking to?
Please quote the significant part of posts that you respond to.

Lee - don't "give up" - it was simply to say that this exchange
contains abusive language which does nothing to assist a genuine
learning forum. There is a lot more to life than computers, and the
current computer languages. Common civilty has to be learned too, and
for some it may be something they never master.
 
E

Evertjan.

Paul wrote on 09 dec 2005 in comp.lang.javascript:
Lee said:
Paul said:

I give up. Who are you talking to?
Please quote the significant part of posts that you respond to.

Lee - don't "give up" - it was simply to say that this exchange [..]

What exchange?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top