String Interpolation

say it: “string in-ter-puh-LAY-shun” /strɪŋ ɪnˌtɜːrpəˈleɪʃən/

Double quotes insert variable values; single quotes keep text as written.

What is String Interpolation?

Double-quoted strings replace variables with their values; single-quoted strings keep text exactly as written. Use $() for expressions.

$name = 'Maria'
"Hello, $name"          # Hello, Maria
'Hello, $name'          # Hello, $name
"Tomorrow: $((Get-Date).AddDays(1).DayOfWeek)"

Level: Apprentice · More PowerShell terms at this level

Updated

In other subjects