Subexpression
noun
say it: “SUB-ek-SPRESH-un” /ˌsʌbɪkˈsprɛʃən/
A piece of PowerShell inside $( ) that is worked out first, so its answer can be placed into text.
What is a subexpression in PowerShell?
A subexpression, $( ), read "the value of", works out what's inside the parentheses and puts the answer in its place. Inside double quotes, $kettle.Length fills in only $kettle; $($kettle.Length) fills in the whole thing, a property or even a command's answer.
"The owl has $($drawings.Count) drawings" # The owl has 3 drawings
In a sentence
- “Without a subexpression, "$kettle.Length" printed the file's path with .Length on the end.”
- “Sam used a subexpression to put the number of drawings into his note.”
Level: Apprentice · More PowerShell terms at this level
Updated