mercredi 4 décembre 2019

What is wrong with the code here? As in, why is it an error?

I want to choose randomly for the index, but I just get

"Cannot implicitly convert type 'string' to 'int'"

 static int NumGen()
        {
            string[] pengs = new string[2] { "agg", "sub" };
            Random numGen = new Random();
            int mepi = numGen.Next(1, 3);
            int mepi2 = numGen.Next(1, 3);
            mepi = pengs[mepi];
            return mepi;
        }



Aucun commentaire:

Enregistrer un commentaire