0

I define the powershell function as below

function t ($a , $b ) {
    write-Host '1-', $a
    write-Host '2-', $b
}

When calling t(4,5) give

1- 4 5
2- 

instead of natural

1- 4
2- 5

How can I get the second?

MUY Belgium
  • 2,172
  • 4
  • 29
  • 42
  • PowerShell separates function arguments with spaces, not commas. look at the gotcha here http://stackoverflow.com/tags/powershell/info – Loïc MICHEL May 20 '15 at 11:10

1 Answers1

1

Kayasax has answered the question in his comment. Function calls do not require parens around the argument(s).

call with

t 4 5

instead of what you did.

Walter Mitty
  • 17,297
  • 2
  • 26
  • 55