If, and While
Level: Beginner
The if and while statements are both critical parts of Python, almost essential to the inner workings of any program written in Python. Getting started, the if statement is pretty self-explanatory (if this equals this do this) the basic syntax of the if statement is as follows.
Now you probably don't know what an operator is yet but I have decided to include a full instructional on operators on the next page, so after you are done here, please continue reading for further instruction. Now the while statement is pretty similar except, every time the code under it finishes it will check if the variable still is what it must be.
Now the while statement can also be used to make loops.
Now this block of code right above this sentence will run on a loop until the process is ended or the computer shuts down. Basically, all the statement above is saying is while running is true do this, and it will of course keep running.
Last updated
Was this helpful?