Hey there,
What is the most efficient way of using an “or” statement for a string in C#? By that I mean having the game register the same response to a variety of possible player inputs. As an example, I want something like this to occur when the game asks the player to enter what kind of food they like:
if (FoodILike == "Burritos") || (FoodILike == "Tacos") { //Allowing for the player to more organically enter a response
PlayerFood = "Mexican";
Debug.Log("The player likes Mexican Food!");
}
Of course, I could always enter something like:
if (FoodILike == "Burritos") {
PlayerFood = "Mexican";
Debug.Log("The player likes Mexican Food!");
}
if (FoodILike == "Tacos") {
PlayerFood = "Mexican";
Debug.Log("The player likes Mexican Food!");
}
But feels way too clunky, especially as I’m hoping to have a broader pool of possible inputs to draw from.
Cheers!