Can we use contains in switch case?

Nope, switch statement requires compile time constants . The statement message. Contains(“test”) can evaluate true or false depending on the message so it is not a constant thus cannot be used as a ‘case’ for switch statement.

Sizin İçin Seçtik  Can you use && in switch case?

Leave a Reply

Your email address will not be published. Required fields are marked *