1

I pass 2 parameters to a function

as I trace inside the function, the arguments values are merged into an array, stored in the first parameter

while the second argument appears to be $null

function SomeFunction($arg1,$arg2)
{
...

SomeFunction("test","test2")

$arg1 is an [Object[2]], containing ["test","test2"], $arg2 is $null

  • how is this even possible ?
  • how can I fix this so that I can get 2 parameters with their respective values

thanks for your help

  • Do not call functions with parentheses in PowerShell. So, instead of `SomeFunction("test","test2")` do this: `SomeFunction "test" "test2"`, or, more formally: `SomeFunction -Arg1 "test" -Arg2 "test2"` – boxdog May 31 '23 at 12:13
  • yes, it figures, thanks for your help – pf12345678910 May 31 '23 at 12:15

1 Answers1

0

the answer is that Powershell functions dont require parenthesis