10: The While Loop

Introduction This will be a short tutorial, as while loops are pretty easy. You MUST understand conditionals to continue. While loops rely on an expression to operate. As long as the expression is True, the loop will run. When the expression stops being True (ie. it is False), so does the loop. WHILE loop structure The basic structure of a while loop is as follows: while (expression): # Do something This will execute the code inside »