C
C#3y ago
bialasik__

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
Brady Kelly
Brady Kelly3y ago
Your code is very hard to read. Maybe try pasting it an a proper code block $code
MODiX
MODiX3y ago
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/
Brady Kelly
Brady Kelly3y ago
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'
bialasik__
bialasik__OP3y ago
omfg TY @Doktor9 ur a legend char playerPawn = Globals.playerPawn; before i had something like this
Want results from more Discord servers?
Add your server