0

Any idea why my script is acting funny?

I am passing it some arguments, but it doesn't seem to be assigning them to the correct variables. E.g.

function test($a, $b, $c){

    write-host "A: " $a
    write-host "B: " $b
    write-host "C: " $c

    $sum = $a + $b + $c

    write-host "The sum is: " $sum
}

test(1,2,3)

Is giving the following output:

A:  1 2 3
B: 
C: 
The sum is:  1 2 3  

What gives?

Ben

0

Dammit.

Should have been using

test 1 2 3

to invoke the function.

Thanks anyway!

Ben

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.