Chapter 5. Scope
Like the previous chapter, this chapter may be a bit of a refresher. But because the concept of scope continues to trip people up, we feel it’s worth our time and yours to get on the same page. More than likely your toolmaking projects will be on the complex side, and if you don’t understand scope, you may end up with a bad tool.
5.1. What is scope?
Scope is a system of containerization. In some senses, it’s designed to help keep things in PowerShell from conflicting with one another. For example, if you ran a script that defined a variable named $x, you’d be pretty upset if some other script also used $x and somehow messed up your script. Scope is a way of building walls between and around different scripts and functions, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access