71.0k views
3 votes
Which of the following expressions would you use to test if a char variable named choice is equal to "y" or "Y"? a. choice.tolower = "y" || "Y" b. choice.tolower = "y" c. tolower(choice) = "y" d. tolower(choice) = "y" || "Y"

1 Answer

5 votes

Answer:

choice.tolower == "y"

Step-by-step explanation:

The tolower method is a string method in c# that converts all characters in a string to lowercase characters(if they are not already lowercase letters) except special symbols which remain the same example "#" symbol.

The tolower method does not take any arguments, therefore to use it, we simply chain it to our string variable(dot notation) and use a comparison operator "==" that evaluates to true or false based on whether the values returned on both sides are equal.

User Diluk Angelo
by
5.4k points