Give your data a name
Use variables, numbers, and string interpolation.
Keep a value for later
A variable starts with $. Assign a value using = and refer to it by name whenever you need it.
$serverCount = 4
$team = 'Operations'
The first value is a number; the second is a string. Types matter: adding two numbers calculates a total, while combining strings joins text.
Two kinds of quotes
Single quotes keep text literal. Double quotes expand variables into their values:
$name = 'Ada'
'Hello, $name'
"Hello, $name"
The first message contains $name. The second says Hello, Ada. To place a calculation or property access inside a double-quoted string, wrap it in $().
$count = 3
"Next count: $($count + 1)"
Use names that explain the data: $serverCount is easier to understand than $x. Variable names are case-insensitive, but consistent spelling makes a script easier to read.
$team = 'Operations'
"Hello, $team"Put it into practice.
Set $serverCount to the number 4, then output Managing 4 servers using that variable.
See an explained solution
$serverCount = 4
"Managing $serverCount servers"Double quotes expand $serverCount into 4. Keeping the count as a number also allows arithmetic later.