CSCI 121 - Lecture 13 Sample

Code 1:
for (x=0; x<=10; x++) {
    document.write("Loop variable X value is: " + x + "<br>");
}
        



Code 2:
var x=0;        
for ( ; x<=5; ) {
    document.write("Loop variable X value is: " + x + "<br>");
    x++;
}
        



Code 3:
var x=0;        
while ( x<=5 ) {
    document.write("Loop variable X value is: " + x + "<br>");
    x++;
}
        



Code 4 :
var x=0;        
do {
    document.write("Loop variable X value is: " + x + "<br>");
    x++;
} while (false);