diff --git a/Loops/while.cpp b/Loops/while.cpp index b234ce8..34c69b5 100644 --- a/Loops/while.cpp +++ b/Loops/while.cpp @@ -8,15 +8,14 @@ using namespace std; */ void while_loop(int max) { - int y = 0; - while (y < max) { - cout << y << " "; - y++; + int y = 0; // define variable to increment and match condition + while (y < max) { // condition when to stop:: when y is less than max, be false - stop + cout << y << " "; // iterate over it and print with a space after the number + y++; // increment by + 1 } } int main() { - while_loop(10); - + while_loop(10); // calling function, param -> max which will be in the condition of the while loop return 0; } \ No newline at end of file