This question already has an answer here:
- How to use ternary operator in C# 11 answers
Im wondering if its possible to write this if statement in shortcode.
if (turnX)
{
matrix[curPosX, curPosY] = (char)1;
}
else
{
matrix[curPosX, curPosY] = (char)2;
}
I would like to see something like this:
turnX ? matrix[curPosX, curPosY] = (char)1 : matrix[curPosX, curPosY] = (char)2;
This code above does not work I found out. If its just not possible its fine for me 2. Im just wondering. If it is indeed possible I would like to also know why.
Aucun commentaire:
Enregistrer un commentaire