Will If Statement not work for choosing variables depending on user input? What should I use instead?
Console.WriteLine("Are you female?");
string answer = Console.ReadLine();
if (answer == "Yes" || answer == "yes" || answer == "YES")
{
string type = She, status = woman;
}
else
{
string type = He, status = man;
}
Console.WriteLine(type + " was a " + status + ".");
Console.ReadLine();
Aucun commentaire:
Enregistrer un commentaire