A variable is basically a little box that holds data. In C#, you have to specify the data type before declaring a variable. That way, the compiler can catch data type mistakes while you're still writing the code.
csharp
string name = "Aung";
int age = 30;
double height = 5.8;
bool isStudent = false;
Console.WriteLine("Name: " + name);
Console.WriteLine($"Age: {age}");
Console.WriteLine($"Height: {height}");
Console.WriteLine($"Student: {isStudent}");What this code does
stringholds text.intholds whole numbers.doubleholds decimal numbers.boolholdstrueorfalse.$"Age: {age}"is string interpolation — a cleaner way to drop a variable's value into a string.
You should see
Name: Aung Age: 30 Height: 5.8 Student: FalseInfo
⚠️ Common mistake
int age = "30"; will throw an error. "30" is text, while 30 is a number. Whether or not you add quotes changes the data type entirely.