Python Python Basics (2015) Number Game App Number Game Introduction

livia salgado
livia salgado
4,407 Points

while true: vs while True: why if i use the first one it shows error? why it has to be capitalized

the console showed error on the line while true: i realiza i had t instead of T, why that is important that's the difference, thanks!

1 Answer

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there! It's because True is a reserved word in the Python language, but true is not. The True value is a built-in constant and is part of the language. If you try and use true, it thinks you're trying to reference a variable name. Almost everything in programming is case-sensitive. This is true regardless of which language you're working with.

Here's some documentation on built-in constants in Python.

Hope this helps! :sparkles: