I'm trying to print a warning to let the user know that 0 isn't a valid option for an assignment for class. Just started learning about powershell and can't find any help on how to set a parameter like this.
Assignment is 3.) Write a loop that calculates $num^2 for each iteration and prints the value using Write-Host. This loop must execute at least once and beginning counting down. When $num = 0, the loop should end. Prevent this loop from receiving $num as 0 as this will cause an infinite loop. If 0 is set as $num, print a warning to let the user know that 0 isn’t a valid option.
So far this is what I have
$num=Read-Host -Prompt 'Enter a number'
do
{
write-host $num
$num--
}
until($num -eq -1)
Any help would be greatly appreciated