Junior — Middle
Can you explain what a constant value in programming is?
sobes.tech AI
Answer from AI
In programming, a constant value is a value that cannot be changed after it is defined. In C#, the keyword const is used to declare a constant. Such values are typically used for fixed parameters, for example, the number Pi or the maximum size of an array.
Example:
const double Pi = 3.14159;
// Pi cannot be changed later
Using constants helps make the code more understandable and prevents accidental modification of important values.