5

Variables, Arrays, and Hashtables

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 providers
  • Scopes and variables
  • Types and type conversion
  • Typed numeric values
  • 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 contain a string such as Hello ...

Get Mastering PowerShell Scripting - Fourth 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.