In the last tutorial we learned about for loops.  In this tutorial we review while loops.  While loops are very simple loops.  They loop while a condition (ex: x > 11) is met.  One major difference between for loops and while loops is that while loops do not declare or update the variable.

/* Intro to  while loop
   Nathan Neil */
   #include <iostream>
   using namespace std;
   int main() {
   int x = 0;
   	cout << "We are entering the loop!\n";
     cout << "The value of x is = " << x << "\n";
	cout << "We are out of the loop!";
   	return 0;



Pin It on Pinterest

Share This

Share this post with your friends!

%d bloggers like this: