3
Variables, Arrays, and Hashtables
A variable in a programming language is used to give a name to a piece of information or data. A variable can be used and re-used in the console, script, or function, or any other piece of code.
A variable may be of any .NET type or object instance. It may contain a string such as "Hello World"
, an integer such as 42
, a decimal such as 3.141
, an array, a hashtable, a ScriptBlock
, and so on. Everything a variable might refer to is an object when used in PowerShell.
This chapter covers the following topics:
- Naming and creating variables
- Variables in strings
- Variable types
- Variable commands
- Variable providers
- Variable scope
- About arrays
- About hashtables
- About Ordered
A variable must be given a name when it ...
Get Mastering PowerShell Scripting - Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.