C# Variables
A variable has a type and a name. Use int, double, string, char and bool, or var to let the compiler infer the type. Variables must be assigned before use.
Example
int age = 21;
double price = 19.99;
string name = "Ada";
char grade = 'A';
bool active = true;
var city = "Lagos";
Console.WriteLine($"{name} {age} {price} {grade} {active} {city}");Exercise
Declare an integer.
n = 5;Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.