mercredi 30 mars 2016

Random value witout if?

Random rd = new Random();
int question;
question = rd.Next(1,2);
if(question ==1)
{
label1.Text = "What is your name?";
}
if(question ==2)
{
label1.Text = "How old are you?";
}

Is there a way how to make it shorter? I need to do it this way, but find the shorter option, preferably witout if.

Aucun commentaire:

Enregistrer un commentaire