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 trial

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

Sebastiaan van Vugt
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Sebastiaan van Vugt
Python Development Techdegree Graduate 13,554 Points

Does pass do the same as continue?

Instead of continue I tried to use pass in a while loop. Even though it runs it doesn't seem to do anything. Is it right that pass and continue are equivalent but that pass should be used in a for loop and continue in a while loop?

Thanks for insights on this matter.

1 Answer

Steven Parker
Steven Parker
231,275 Points

You can use "continue" in any kind of loop, but it cannot be used outside of a loop. It causes the loop to repeat immediately without waiting until the the current iteration completes. It might appear to be doing nothing if it's at the end of the loop.

On the other hand "pass" can be used in or out of loops. It serves only as a placeholder and doesn't do anything.