Note that we’ve not included some video lessons from the original course, since we’ll be looking at examples in our mini-projects and during live sessions
This lesson is part of a Real Python video course by Paul Meulus.
You must own this product to watch this lesson.
You must own this product to watch this lesson.
Note that we’ve not included some video lessons from the original course, since we’ll be looking at examples in our mini-projects and during live sessions
This lesson is part of a Real Python video course by Paul Meulus.
00:00
The pass Statement. In the next slide, I’m going to show you what the pass statement does. Nothing! Isn’t it beautiful? You’ll use the pass statement as a placeholder.
00:13 You’ll hear it called a code stub. This is typically used when you’re building something out and maybe you’re on a roll and you just kind of want to put the rough outline out there of your code and you’re going to come back to it later.
00:26
The pass statement is great for doing this. So, why don’t we jump into the console for an example? Let’s jump into the code that you wrote for video two, the calorie counter app. Let’s say you slept on it, you had a great idea, and you want to take this app to the next level but you want to make some changes. Give this a try on your own.
00:47 So, if I delete this line
00:51
and try to run this program, I should get an error. Yeah, see? We got a IndentationError: expected an indented block. Now, if I come back in, indent, and give this the pass statement,
01:10
it won’t do anything, but it’ll run just fine. There you go! Now you’re free to make all the changes to your heart’s content without throwing errors! That concludes the pass statement. See you in the next one.
You must own this product to join the conversation.
Get a Python Cheat Sheet (PDF) and learn the basics of Python, like working with data types, dictionaries, lists, and Python functions: