Skipping part of code when a condition matches

Part of a script I’m working on uses Read-Host to get user password for an access account. Then it tests if it can use that account to gain access to a particular host. All was great till it was decided that the account should not exist on certain hosts. To deal with that I was thinking of giving whoever runs the script the option to say ‘No’ so when it get’s detected the whole part of code that does the access test get’s skipped. Not sure if this is the best solution but should be simple enough for whoever runs the script.
I was expecting something like Case statemnt so I can say
Select Case $pass
Case “No” 'do nothing
Case else
run the test code
How would I go about this sort of problem in Powershell?

A simple IF statement should do fine here, though you could also use Switch if that’s your preference (which is the PowerShell equivalent of Select Case).

if ($pass -ne 'No')
    # Run the test code

Often the simplest solution proves best. Many thanks.