3

I'm new to powershell and i have this question:

I made this function:

Function A_Function($a,$b){
    $d = $a + $b
    $d
}
A_Function "0","1"

The problem is, that this function gives this as output:

0
1

And I would like it to be on one line:

01

I tried things like:

$d = ($a + $b) #result: same a sabove
$d = (""+$a + $b+"") #result: 1 0, but i dont want that space inbetween
$d = "$a$b" #result: 1 0, but i dont want that space inbetween

Thank you for helping

1 Answer 1

6

You are sending an array and it will bind to $a only. In PowerShell you delimit arguments with a space. Try this way instead:

A_Function "0" "1"

Also note that you're adding two strings, the result will be "01" ant not 1, in case you wanted to add numbers.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.