this is my code. Basically it gives a compiler error
teclaPulsada=Console.ReadKey(true);
if (teclaPulsada.Key=ConsoleKey.Q | teclaPulsada.Key=ConsoleKey.A | teclaPulsada.Key=ConsoleKey.Z)
{
//I do something
}
Then another question, I have this code, that it seems to be equal to the previous one, but this also uses ConsoleKey and int
if ((teclaPulsada.Key=ConsoleKey.Q & Pregunta.retornarPosicioRespostaCorrecta()==0) | (teclaPulsada.Key=ConsoleKey.A & Pregunta.retornarPosicioRespostaCorrecta()==1) || (teclaPulsada=ConsoleKey.Z & Pregunta.retornarPosicioRespostaCorrecta()==2))
{
//I do something
}
In both cases I have tried diffrent systems, like using && or & and || or |. I have also tried using .key. But I'm stucked.
Thanks
Aucun commentaire:
Enregistrer un commentaire