title: Function not outputting value?
body: <p>I'm working on a PowerShell script for some work use, and am having trouble getting a function it's data directly to a variable. Below is the function and my test:</p>
  
  <pre><code>function validateInput {
      Param(
          [string]$Text = 'Put text here'
      )
  
      do {
          try {
              $numOk = $true
              $GetMyANumber = Read-Host "$text"
  
              if ($GetMyANumber -gt 3){
                  $numOK = $false
              }
          } catch {
              $numOK = $false
          }
          if ($numOK -ne $true) {
              cls
              Write-Host "Please enter a valid number" -Foreground Red
          }
      } until (($GetMyANumber -ge 0 -and $GetMyANumber -le 3) -and $numOK)
  }  
  
  $firstName = validateInput($firstNamePrompt)
  $lastName = validateInput ($lastNamePrompt)
  
  Write-Host "First name length is $firstname"
  Write-Host "Last name length is $lastname"
  </code></pre>
  
  <p>My understanding is that the in the last few lines, the function SHOULD assign it's output to the variables <code>$firstName</code> and <code>$lastName</code>, but I output that, they are blank. I'm sure I'm missing something obvious here, but can anyone let me know what I'm screwing up? </p>