By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,667 Members | 2,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,667 IT Pros & Developers. It's quick & easy.

Do Until Loop

P: n/a
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);

Nov 25 '05 #1
Share this Question
Share on Google+
15 Replies


P: n/a
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

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Nov 25 '05 #2

P: n/a
shannon wrote:
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
Nov 25 '05 #3

P: n/a
Thomas 'PointedEars' Lahn wrote on 25 nov 2005 in comp.lang.javascript:
shannon wrote:
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);


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

Very useful!
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Nov 25 '05 #4

P: n/a
Evertjan. wrote:
Thomas 'PointedEars' Lahn wrote on 25 nov 2005 in comp.lang.javascript:
shannon wrote:
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);


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
Nov 25 '05 #5

P: n/a
[My previous posting containde pseudo-code, I wanted to post script code]

Evertjan. wrote:
Thomas 'PointedEars' Lahn wrote on 25 nov 2005 in comp.lang.javascript:
shannon wrote:
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);


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
Nov 25 '05 #6

P: n/a
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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 25 '05 #7

P: n/a
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?


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

Just making a joke as such.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Nov 25 '05 #8

P: n/a
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.
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
Nov 25 '05 #9

P: n/a
shannon wrote in message news:11********************@z14g2000cwz.googlegrou ps.com...
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);

Nov 26 '05 #10

P: n/a
In article <21****************@PointedEars.de>, Thomas 'PointedEars'
Lahn <Po*********@web.de> writes

<snip>
do
{
alert('as long as condition applies') // But do it once even if the condition is initially false }
while (condition);

<snip>

John
--
John Harris
Nov 26 '05 #11

P: n/a
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.
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.


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....cc4f20ec68b6e6
Theory: Thomas's warped view of the world.
Reality: You are wrong.
Top-posting is *never* acceptable. Even when correcting oneself.

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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 26 '05 #12

P: n/a

Randy Webb wrote:
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.
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.


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....cc4f20ec68b6e6
>


Theory: Thomas's warped view of the world.
Reality: You are wrong.
Top-posting is *never* acceptable. Even when correcting oneself.

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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Dec 8 '05 #13

P: n/a
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

Dec 8 '05 #14

P: n/a

Lee wrote:
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.


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.

Dec 9 '05 #15

P: n/a
Paul wrote on 09 dec 2005 in comp.lang.javascript:
Lee wrote:
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.


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


What exchange?

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Dec 9 '05 #16

This discussion thread is closed

Replies have been disabled for this discussion.