While loop and if(elif) operators

Hello, everyone!
I am studying Python 3 at the moment and it is going quite well. Now while taking notes about While loop, a question sprung to my mind.

While loop checks conditions (till the condition is True, the loop is going on), okay. In the topic of boolean operators we were talking about operator “if”, which also checks conditions. So, I am actually a bit confused when it is better to use a “while” loop or an “if” operator, could you explain? Thank you in advance!

The use of either of those control flow/ compound statements depends on what you’re trying to accomplish.

The while statement will run (or execute) as long as the expression evaluates to True.


See also:

And, if statements used for conditional execution: