var, const and readonly
var infers a local type. const is a compile time constant and readonly can be set once in a constructor.
Example
var n = 10;
const double Pi = 3.14159;
var text = "typed as string";
Console.WriteLine($"{n} {Pi} {text}");Exercise
Constant keyword.
int Max = 5;Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.