Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop Problem 1

Status
Not open for further replies.

SilverElectron

Programmer
Apr 10, 2003
23
0
0
CA
I know this is going to seem stupid but I can't get this code to work. I have IE 6 and it doesn't run any aspect of this code, It just says: Error on page. Perhaps someone will find a mistake (if there is one...).

var num=0;

do{
num+=1;
alert('hi');

if(num==5){
break;
}
}

Thanks,
-SE
 
try this:

[tt]var num=0;

do{
num+=1;
alert('hi');
} while (num != 5)
[/tt]

or this
[tt]
var num=0;

do{
alert('hi');
} while (++num != 5)[/tt]


=========================================================
while (!succeed) try();
-jeff
 
The "while" of course!!! How could I be so stupid? It's not hard to tell that I'm not a Do-Loop kinda guy.

Thanks Jeff.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top