Python - While false loop Python - While false loop python-3.x python-3.x

Python - While false loop


If you want 'while false' functionality, you need not. Try while not fn: instead.


The condition is the loop is actually a "pre-" condition (as opposed to post-condition "do-while" loop in, say, C). It tests the condition for each iteration including the first one.

On first iteration the condition is false, thus the loop is ended immediately.


In python conditional statements :

'' is same as False is same as 0 is same as []