Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

Dammit.

Should have been using

test 1 2 3

to invoke the function.

Thanks anyway!

Ben

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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