This chapter explores variables, along with a detailed look at arrays and hashtables, as these have their own complexities.
A variable in a programming language allows you to assign a label to a piece of information or data. A variable can be used and reused in the console, script, or function or in any other piece of code.
In this chapter, we're going to cover the following topics:
- Naming and creating variables
- Variable commands
- Variable provider
- Variable scope
- Types and type conversion
- Objects assigned to variables
- Arrays
- Hashtables
- Lists, dictionaries, queues, and stacks
A variable may be of any .NET type or object instance. The variable may be a string Hello World, an integer 42, a decimal 3.141, an array, a hashtable, a ScriptBlock, and so on. Everything a variable might hold is considered to be an object when used in PowerShell.
...