Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
All programming languages have a set of basic or primitive types from which everything else is built. These primitive types usually have some form of corresponding syntactic literal. Literal tokens in the language are used to represent literal data objects in the program. In PowerShell there are the usual literals—strings, numbers, and arrays—but there are some other literals that aren’t typically found outside of dynamic languages: dictionaries and hashtables. PowerShell also makes heavy use of type literals that correspond to type objects in the system. In this section, we’ll go through each of the literals, illustrate how they’re represented in script text, and explore the details of how they’re implemented in the PowerShell runtime.
There are four kinds of string literals in PowerShell: single-quoted strings, double-quoted strings, single-quoted here-strings, and double-quoted here-strings. The underlying representation for all of these strings is the same.