Last active
August 29, 2015 14:03
-
-
Save macikokoro/a5b55668241156c671e4 to your computer and use it in GitHub Desktop.
While loop and for loop combo.
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
var totalCars = 10; | |
var carsOperational = 8; | |
var carNumber = 1; | |
while(carNumber <= carsOperational) { | |
console.log("Car #" + carNumber + " is running."); | |
carNumber++; | |
} | |
for( var stoppedCar = carsOperational + 1; stoppedCar <= totalCars; stoppedCar++) { | |
console.log("Car# " + stoppedCar + " is not operational."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment