Join Barron Stone for an in-depth discussion in this video Break statements, part of Programming Foundations: Real-World Examples.
- Now that all of my dishes are finally clean,…I'm ready to unload the dishwasher…and put the clean dishes into the cabinet.…This is a perfect operation to execute using a for loop,…because I know that there are 20 clean dishes…in the dishwasher, and I plan to unload all of them.…So, I'll count aloud as I unload each one.…I'll pick up the first dish,…put it away.…That's one.…I'll pick up the second dish, and put it away as well.…That's two.…I'll pick up the third dish.…
Well, my cabinet is full,…which means I need to stop this process,…because there's no space left.…I had originally planned to put away all 20 dishes,…but because this happened,…I'll need to exit my for loop early,…and leave the unprocessed dishes in the dishwasher.…If I had checked the cabinet before I started,…I might have seen that it only had space…for two dishes, which is way less than…the number of dishes in the dishwasher,…and in that case, I could have modified my for loop…to only process two dishes…instead of trying to process all 20.…But if I can't look at the cabinet ahead of time…
- Reusing functions
- Local vs. global variables
- Creating and naming custom objects
- Class inheritance
- Modules and packages
- Multidimensional lists and tuples
- Queues and stacks
- Creating and combining sets
- Storing data in dictionaries
- If/else and switch statements
- For vs. while loops
- Error handling
- Polling and event-driven programming
Skill Level Beginner
Programming Foundations: Design Patternswith Elisabeth Robson2h 19m Intermediate
3. Class Inheritance
4. Modules and Packages
5. Lists and Tuples
6. Queues and Stacks
9. Conditional Execution
11. Error Handling
12. Polling and Event-Driven Programming
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.