Posts Tagged ‘scope’


First rule of PowerShell scoping rules…

Wednesday, March 6th, 2013 by Alex Riedel
… never talk about PowerShell scoping rules. Judging from the posts, emails and questions we get about variable scope in PowerShell Studio forms, PowerShell scoping rules are shrouded in mystery. When you read about_scopes you get a lot of information. When you come from any other scripting language, for example VBScript, you are used to two scopes; global and local. The default scope of a variable in VBScript depends on its first use or its declaration. So if you want a variable to have a specific scope you just declare it with a DIM statement. This code sample illustrates…   More »

PrimalScript 2012: What’s new? (Part 7)

Wednesday, May 9th, 2012 by Alex Riedel
Last time we told you about some new debugger features in PrimalScript 2012. And you already know all about the new Ribbon user interface this new version sports. One thing that we were really focused about in this version was to make navigating your code easier. Since there is no “PrimalSense” toolbar anymore the method combo box that enabled you to jump between functions needed to find a new home. If you load a file into PrimalScript 2012 you will notice the two new combo boxes on top of the edit window: The right-hand combo box serves as an indicator…   More »

Don’t modify out-of-scope items

Sunday, March 23rd, 2008 by Don Jones
Scripts, functions, and other elements should NEVER modify the variables, aliases, PSDrives, or other items from parent scopes. Instead, return data to the parent scope using the pipeline. Changing parent scope items creates code which is much more difficult to debug and maintain, and can create inconsistent results when run on different systems.…   More »