Collin Day
0
Q:

how to create a variable in C#

// All types of variables
int MyNumber = 2; // A number
float MyDotNumber = 2.2; // A Number with decimals
string MyText = ("Hello World") //Text
bool YesOrNo = true; //True or False

// Formats

(Type) (Name) = (Value);
E.g:
int NameOfVariable = (Value depending on type)
6
 int variable;
6
public int yourNumber = 5;
1

New to Communities?

Join the community