Ad

Completed your previous solution to correctly check both cases.

Code
Diff
  • public class Kata
    {
        public static int SameCase(char a, char b)
        {
            if (!char.IsLetter(a) || !char.IsLetter(b))
            {
                return -1;
            }
    
            return (char.IsUpper(a) && char.IsUpper(b)) || (char.IsLower(a) && char.IsLower(b)) ? 1 : 0;
        }
    }
    
    • public class Kata
    • {
    • public static int SameCase(char a, char b)
    • {
    • if (!char.IsLetter(a) || !char.IsLetter(b))
    • {
    • return -1;
    • }
    • return (char.IsUpper(a) == char.IsUpper(b)) ? 1 : 0;
    • return (char.IsUpper(a) && char.IsUpper(b)) || (char.IsLower(a) && char.IsLower(b)) ? 1 : 0;
    • }
    • }