Store a value
Give a number a name so you can use it again.
Simple example
Start5
Result5
using System;
int seats = 5;
Console.WriteLine(seats);
5
Advertisements
Everyday examples
A bus has 12 seats. Five are taken. How many seats are free?
Start12 − 5
Result7
using System;
int seats = 12;
int taken = 5;
Console.WriteLine((seats - taken));
7
Run the example
dotnet new console --output Lesson
cp Program.cs Lesson/Program.cs
dotnet run --project Lesson