Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Shopping List App Shopping List Introduction

Idan shami
Idan shami
13,251 Points

I don't understand why 'DONE' is infinite...

I understand that new_itme, for example, is infinite because you can add always more items, and you don't have a limit for how many items you put on the list.

But 'DONE' is not infinite, you can not write DONE many times, only 1 time... maybe this question is kind of stupid but if you have an example it will help a lot...

Thank you, Idan.

Idan shami
Idan shami
13,251 Points

watch the video ^ to know what i am talking about P: Thanks.

2 Answers

Nazim Mohamed
Nazim Mohamed
1,014 Points

DONE isn't infinite you can only enter it once and the the code stops using the BREAK

Idan shami
Idan shami
13,251 Points

so why he is indented to the while loop?

Nazim Mohamed
Nazim Mohamed
1,014 Points

It is indented in the loop so that it is checked for everytime the loop runs, but the moment the DONE is inputted the BREAK stops the code regardless of it being in the loop.