Join Barron Stone for an in-depth discussion in this video Local and global variables, part of Programming Foundations: Real-World Examples.
- While I'm in the process of cooking something,…I like to keep the things I'm working with close at hand.…In my local area.…Functions do the same thing when they execute…by keeping their input parameters…and any variables which are created inside of the function…within that function's local scope.…When I want to use a specific resource,…I'll look for it first in the local area.…So, if I want to add some bacon to my omelette,…I'll look for it near by.…Here it is.…So we'll add that.…Now, if I want to add some cheese to my omelette,…I'll start by looking for it in my local scope.…
But I don't seem to have any cheese here…so I'll expand my search to look in the global scope.…And in this case,…that's my kitchen.…So, I'll go get some cheese from the fridge.…Oh! - Ooh! Bacon!…Can I have some?…- Oh no, no, no, no.…You can't touch that bacon.…That bacon is my input ingredient,…which means it's in my local scope.…Only I can use objects that are local to my function…while I'm executing it.…If you're hungry you can have some cheese.…
- 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.