C# Constants
const creates a value that cannot change after it is declared, and it must be set at compile time. Use readonly for values set once at runtime.
Example
const double Pi = 3.14159;
Console.WriteLine(Pi);
// Pi = 3; // errorExercise
Declare a constant.
int Max = 10;Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.