View Single Post
  #8 (permalink)  
Old May 1st, 2009, 05:04 AM
Old Pedant Old Pedant is offline
Friend of Wrox
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts

What the Original Poster wanted was to be able to Press a [KEY] to Break a "For...Next" Loop.
I'm sorry, but you are showing your ignorance of other programming languages when you say that.

I understand you think he was talking about pressing some kind of "break" key, but no, he wasn't.

In C and C++ and Java and JavaScript and C# and PHP and various other languages, the keyword break is used to prematurely exit from a loop (as it turns out, from any kind of loop).

Example in javascript:
for ( var i = 1; i <= 100; ++i )
    document.write("This is iteration " + i + "<br />" );
    if ( i > 17 ) break;
That loop will *NOT* execute 100 times, as you might think from reading the for line.

Instead, it will execute 18 times, because on the 18th iteration the variable i is indeed greater than 17 and the break keyword says "exit from the enclosing loop."

And *THAT* is what the original poster in this thread meant when he asked if there is any VBScript equivalent of the JAVA keyword break. (And Java also has a continue keyword which he was asking about, at the same time.)

And, yes, the EXIT FOR and EXIT DO keywords are the closest equivalents, in VBScript and in VB6 and in VB.NET, of the Java break keyword.
Reply With Quote