473,769 Members | 5,862 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Do Until Loop

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
15 51855
shannon wrote on 25 nov 2005 in comp.lang.javas cript:
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
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
Thomas 'PointedEars' Lahn wrote on 25 nov 2005 in comp.lang.javas cript:
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
Evertjan. wrote:
Thomas 'PointedEars' Lahn wrote on 25 nov 2005 in comp.lang.javas cript:
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
[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.javas cript:
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
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.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 25 '05 #7
Thomas 'PointedEars' Lahn wrote on 25 nov 2005 in comp.lang.javas cript:
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
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
shannon wrote in message news:11******** ************@z1 4g2000cwz.googl egroups.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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
15681
by: Eric | last post by:
Let me start off by saying I have VB working model which means no help. I have searched MSDN. It seems that I get "Read the help" instead of answers which is totally useless to me. With that said can someone please help me understand why this does not work? Dim x As String Private Sub cmdlogin_Click() Do Until x = "Corey" If txtlogin = "Corey" Then
4
5835
by: .Net Sports | last post by:
I am trying to display records from a recordset after sql statement: <% sqlstr ="SELECT horsename FROM tblhorseentry WHERE trackname = '" & request.querystring("trackname") & "' and racedate = '" & request.querystring("racedate");" Set rs1 = Server.CreateObject("ADODB.Recordset") rs1.Open sqlstr,pConn,3
2
1792
by: MLH | last post by:
Take a look at the code that follows. Line 110 is the beginning of Do-Loop. Regarding line #220, I find that I'm getting Error #3021 (No Current Record) during execution of line #230. It puzzles me as to Why? I thought if I was on last valid record of RecSet when line #220 executes, I would be sent to process lines after line #400. Am I wrong about that? ==> BEGIN CODE SNIPPET <=== 110 Do Until RecSet.EOF StartAnew:
3
4945
by: abitlikehomer | last post by:
Hi i am writing a bit of code so that the date and time of a booking can not be booked twice but i am getting an error message saying "loop without do". Any suggestions? setflag = False Do Until EOF(1) Or setflag = True If customer.bookingdate <> txtdate Then GoTo loopend If txttimefrom >= customer.timefrom And txttimefrom < customer.timeto Then setflag = True Else ' 'potentially ok'
3
2091
by: peter.meth | last post by:
Hi All, I am making a file manager type of application and am trying to duplicate Windows Explorer's behaviour when copying files; ie, display a second form with the copy files animation. As it is copying files, it should show the file name and folder. For testing purposes I am sleeping for 1 second to simulate a file being copied. My problem is that when I run the code, the labels do not change to reflect the file names until the...
4
143991
by: Madhavi | last post by:
Hi Is there any Do Until Loop in C# Maadhavi
3
11875
by: SyGC | last post by:
Hi People, Im trying to do a simple Loop where by an IP address is pinged (Using My.computer.network.ping) and the results, true or false, are used to invoke another line of code. Basically if the IP is pingable (true) image A is displayed if it is not (false) then image B is. The code i am using is as follows Dim IPAddress As String = "192.168.1.122"
2
3161
by: Constantine AI | last post by:
Hello, i am wanting a Loop procedure to check details of all the multiple rows with the following D-LOOKUP procedures; StkID.Value = DLookup("", "stkmas", " = Forms!!") Price.Value = DLookup("", "primas", " = Forms!!") For the Loop procedure to work i have used the following code: Dim dbs As Database Dim rst As Recordset Dim Reply As String Dim strSQL As String Set dbs = CurrentDb
5
9289
by: dbrother | last post by:
Access 2003 Win XP Pro SP3 Using SQL /ADO Recordsets in a Do Loop Hello, I'm using a random number generator based on an integer input from a user from a form that will get X number of random records from an external Oracle source using a SQL statement. The SQL statement works as expected when the loop code is commented out, but I receive an error "SQL command not properly ended" when the loop is active. Do Until intLoop = UserNum ...
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9416
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7393
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6661
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3948
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2810
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.