Ad
  • Default User Avatar

    Late answer, sorry. Hope you're still up for the challenge!
    The problem is that the compiler doesn't know if inside of the foreach something will be returned, so you'd just need to return anything after the foreach, or throw an exception. Then your code should compile

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    You could also do char.IsUpper(str[i])

  • Custom User Avatar

    have you tried using Char.isUpper instead of Char.IsUpper ?

  • Custom User Avatar

    The problem is the 'case > 3' statement, which falls under what I said :P You could, however, just make it the 'default' case.

    The question seems to be answered, so I'll close this.

  • Default User Avatar

    i tried it too and apparently =>, <, ect. is not allowed in switch cases. we can use "default" after checking for the other cases instead.

  • Custom User Avatar

    You're probably trying to use a newer C# feature that is not supported on current available versions. Relational pattern matching was introduced in C# 9, but only C# 8 is available on CW at the moment.