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

    Figured it out... was missing the { } below the if statement. Oops.

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    Ok now I got it...I admit my ignorance and the very seldom use of this kind of notation with three dots "...". Now I understand it is the "Arbitrary Number of Arguments"...

  • 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.

  • Default User Avatar

    Oh wow... okay as a beginner I had no clue I'm doing something fairly new. Thanks alot.

  • 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.

  • Default User Avatar

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