do...while Statement
Executes a statement block once, and then repeats execution of the loop until a condition expression evaluates to false.
do
statement
while (expression)
The following example illustrates the use of the do...while statement to iterate the Drives collection.
function GetDriveList(){
var fso, s, n, e, x;
fso = new ActiveXObject("Scripting.FileSystemObject");
e = new Enumerator(fso.Drives);
s = "";
do {
x = e.item();
s = s + x.DriveLetter;
s += " - ";
if (x.DriveType == 3)
n = x.ShareName;
else if (x.IsReady)
n = x.VolumeName;
else
n = "[Drive not ready]";
s += n + "\n";
e.moveNext();
}
while (!e.atEnd());
return(s);
}
Show: