Link for all dot net and sql server video tutorial playlists
Link for slides, code samples and text version of the video
while loop :
1. while loop checks the condition first
2. If the condition is true, statements with in the loop are executed
3. This process is repeated as long as the condition evaluates to true.
do while loop :
1. do while loop checks its condition at the end of the loop
2. This means the do…while… loop is guaranteed to execute at least one time.
3. In general, do…while… loops are used to present a menu to the user
1. while loop checks the condition at the beginning, where as do…while… loop checks the condition at the end of the loop
2. do…while… loop is guaranteed to execute at least once, where as while loop is not.
do while loop example
var userChoice = “”;
var targetNumber = Number(prompt(“Please enter your target number”, “”));
var start = 0;
while (start [= targetNumber)
document.write(start + “[br/]”);
start = start + 2;
userChoice = prompt(“Do you want to continue – Yes or No”).toUpperCase();
if (userChoice != “YES” && userChoice != “NO”)
alert(“Invalid choice. Please say, Yes or No”);
} while (userChoice != “YES” && userChoice != “NO”);
} while (userChoice == “YES”);