© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
11 replies
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 = ' ';
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Public Static Variable Not Updating in other scripts
C#CC# / help
4y ago
✅ static, public, void
C#CC# / help
16mo ago
✅ static r public?
C#CC# / help
16mo ago
Properly understanding Public Static
C#CC# / help
2y ago