Chapter 1. Variables, Arrays, and Hashes
PowerShell provides a variety of mechanisms to store, retrieve, and manipulate data used in your scripts. These storage "containers" are referred to as variables, arrays, and hashes. They can be used as containers to store strings, integers, or objects. These containers are dynamic as they automatically detect what type of data is being placed within them. Unlike other object-oriented languages, there is no need to declare the container prior to use. To declare one of these containers, you use the dollar sign ($
) and the container name.
An example of a container would look like this:
$myVariable
During this chapter, you will learn the following concepts:
- Variables
- Arrays
- Hashes
- Deciding the best container for your scripts
When you are creating names for containers, it is industry best practice to use names that are representative of the data they are storing. While containers are not case sensitive in PowerShell, it is a common practice...