Function PlayGame([int]$min, [int]$max, [int]$guessNumber) {
Write-Host "This is a guess-the-number game.
You have 6 guesses to guess a number between 1 and 100.`r`n"
[int]$secretNum = Get-Random -minimum $min -maximum ($max + 1)
[bool]$exit = $false
1..$guessNumber | :guessLoop ForEach {
[int]$guess = Get-ValidGuess $min $max
If ($exit) { continue }
If ($guess -eq $secretNum) {
Write-Host "Correct!"
$exit = $true
break guessLoop