Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialZhuxiao Gu
574 Pointswhat does "while True" really mean?
I see Kenneth has used twice "while True" for the big loop. What does "while True" mean? What is considered "False"? Is there an alternative for this?
1 Answer
Saiteja Vemula
7,162 PointsTrue is a boolean value. A while loop will evaluates the given condition and checks if it is True or False. If the condition evaluates to True, only then the loop runs. If the condition evaluates to False, the loop breaks. In order to repeat the loop infinitely, you can use :
while True :
It works because, when the given condition gets evaluated, it will return a boolean value.
Zhuxiao Gu
574 PointsZhuxiao Gu
574 PointsThank you Saiteja.