Last active
August 29, 2015 14:03
-
-
Save macikokoro/db044e0062b5e494ff4e to your computer and use it in GitHub Desktop.
For loop example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Syntax of a for loop: | |
for ( *start with this* ; *loop if this expression is true* ; *do this after each loop*) { | |
* in each loop, d this code!* | |
} | |
In order (initialize; check condition; control the loop) */ | |
//Not operational cars | |
var carsOperational = 10; | |
var totalCars = 14; | |
for (var stoppedCar = carsOperational + 1; stoppedCar <= totalCars; stoppedCar++ ) { | |
console.log("Car #" + stoppedCar + " in not operational."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment