title: Can I create an array of functions in Powershell?
body: <p>I would like to have an array that contains a set of functions that I can iterate through and call. The issue is that the functions all run via the line that adds them to the array (ie. $scripts).</p>
  
  <p>Example:</p>
  
  <pre><code>function Hello
  {
      $BadFunction = "Hello"
      Write-Host "Hello!"
  }
  
  function HowAreYou
  {
      $BadFunction = "HowAreYou"
      Write-Host "How are you?"
      #$false = $true
  }
  
  function Goodbye
  {
      $BadFunction = "Goodbye"
      Write-Host "Goodbye!"
  }
  
  $scripts = @((Hello), (HowAreYou), (Goodbye))
  
  foreach ($script in $scripts)
  {
      $script
  }
  </code></pre>