public static variable not changing
if (choice == 'H' && coinFlip == 1 ||
choice == 'T' && coinFlip == 2)
{
playerPawn = 'O'; // one instance where i want to change this variable
PlayerTurn();
ValuesCheck();
}
else
{
playerPawn = 'X';
ComputerTurn();
ValuesCheck();
}
##############################################################
public static class Globals
{
public static char[,] values = {
{ ' ', ' ', ' ' },
{ ' ', ' ', ' ' },
{ ' ', ' ', ' ' } }; // this changes fine in the exact same class the other variable is
but playerPawn does not
public static char playerPawn = ' ';
}
4 Replies
Your code is very hard to read. Maybe try pasting it an a proper code block
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
If your code is too long, post it to: https://paste.mod.gg/I can't see you accessing any properties of the
Globals
class in your other code so playerPawn = 'O'
doesn't make any sense because that variable isn't declared anywhere
I would have expected to see Globals.playerPawn = 'O'
omfg
TY
@Doktor9 ur a legend
char playerPawn = Globals.playerPawn;
before
i had something like this