Introduction
The -f operator helps you create neat and readable text by inserting values into a string in a clear way.
'format string {0} {1}' -f value1, value2'Hello, {0}!' -f 'Alice'
'{0} + {0} = {1}' -f 2, 4
'Number: {0:D4}' -f 7
'Price: {0:C2}' -f 12.5
$name = 'Bob' $age = 30 $balance = 1234.5 $message = 'Name: {0}, Age: {1}, Balance: {2:C2}' -f $name, $age, $balance Write-Output $message
-f operator do in PowerShell?$name and $age into a string using the -f operator?$num = 7.12345
"Rounded number: {0:N2}" -f $num
"User: {0}, Score: {1}" -f $user-f operator inside a loop. Which code snippet correctly formats each price stored in $prices array?Pass the test and this pattern moves unknown