Help with this password checker project c#

whenever i try to dotnet run the code i was get " Program.cs(59,9): error CS8070: Control cannot fall out of switch from final case label (‘default:’) [/home/ccuser/workspace/csharp-password-checker/PasswordChecker.csproj]

The build failed. Fix the build errors and run again."

the copy of my code is this

using System;

namespace PasswordChecker
{
class Program
{
public static void Main(string args)
{
int minLength = 8;
string uppercase = “ABCDEFGHIJKLMNOPQRSTUVWXYZ”;
string lowercase = “abcdefghijklmnopqrstuvwxyz”;
string digits = “0123456789”;
string specialChars = “#?!”;

  //asking the user for password

  Console.Write("enter your password:   ");
  string password = Console.ReadLine();
  
  // password check score

  int score = 0;

  if (password.Length >= minLength) 
  {
    score++;
  }
  if (Tools.Contains(password, uppercase)); {
    score++;
  }
  if (Tools.Contains(password, lowercase)); {
    score++;
  } 
  if (Tools.Contains(password, digits)); {

  score++;
  } 
  if (Tools.Contains(password, specialChars)); {
    score++;
  } 
  switch (score) 
  {
    case 5:
    case 4:
    Console.WriteLine("strong password");
    
    break;
    
    case 3:
    Console.WriteLine("password is strong");
    break;

    case 2:
    Console.WriteLine("password is medium");
    
    break;

    case 1:
    Console.WriteLine("password is weak");
    
    break;
    default:
    
    Console.WriteLine("password does not meet requirements");
    break;
  }






}

}
}

Welcome to the forums :slight_smile:

What happens with case 5?
In the future, you can format your code with the </> before pasting for more legibility.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.