jeudi 7 novembre 2019

Can this if statement go in shortcode? C# shortcode [duplicate]

This question already has an answer here:

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