#PSTip Initializing multiple variables at once

Here’s another cool variables tip. Say you want to initialize a few variables to a specific value. Instead of doing:

$a = 1
$b = 1
$c = 1
$d = 1

Try PowerShell’s assignment expressions!

PS> $a=$b=$c=$d = 1
PS> $a,$b,$c,$d
1
1
1
1
Share on: