0
function function1(){
    Param($a)    
    "YOU HAVE entered : $a"
    $arr+=$a    
    $arr2.Add($a)
}

workflow wf{
    Param($b)
    Parallel{
        sequence{
            function1 $b
        }
    }
}

$arr = @()
$arr2 = [System.Collections.Arraylist]@()
wf -b 10
$arr
$arr2

The output I am getting as below

YOU HAVE entered : 10

Microsoft.PowerShell.Utility\Write-Error : You cannot call a method on a null-valued expression.
At wf:12 char:12
+ 
    + CategoryInfo          : NotSpecified: (:) [Write-Error], RemoteException
    + FullyQualifiedErrorId : System.Management.Automation.RemoteException,Microsoft.PowerShell.Commands.WriteErrorCommand
    + PSComputerName        : [localhost]

I am unable to update both the arrays which I declared outside the function and workflow.

3

0

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.