title: Boolean variable gets returned as an Object[]
body: <p>I have a function which is returning a boolean variable</p>
  
  <pre><code>function test ($param1, $param2)
  {
    [boolean]$match=$false;
  
    &lt;# function logic #&gt;
  
    return $match
  }
  </code></pre>
  
  <p>when I try and catch the function call in a variable $retByFunct=testing $param1 $param 2</p>
  
  <p>I am getting $retByFunct as an Object Array. If I try and force the $retByFunct to be a boolean variable i.e. [boolean] $retByFunct=testing $param1 $param 2, I get the following error.</p>
  
  <blockquote>
    <p>Cannot convert value "System.Object[]" to type System.Boolean</p>
  </blockquote>
  
  <p>I checked out $match.GetType() just before returning it. The console says its a boolean, so am confused as to why after function call its getting converted to an Object Array.</p>
  
  <p>I am aware this happens for some collection objects and there is a work around for that, but how do I handle a case for a variable?</p>