PowerShell: calling a function with parameters
I just started with PowerShell to do some complex scripting. As a beginner in this new language I will probably run into all the quirks that the language has, but hey thats the fun with learning something new. The first quirk: calling a function with parameters.
function f([string]$a, [string]$b)
{
Write-Host "a:", $a, " b:", $b
}
f("hello", "world") # Results in: a: hello world b:
f "hello" "world" # Results in a: hello b: world
If you put something between parentheses, it is executed as an expression first.
For more information on what you can do with functions, execute the following command in your PowerShell: Get-Help about_function