Day 40

C# Constants

Constants

If you don't want others (or yourself) to overwrite existing values, you can add the  const keyword in front of the variable type.

This will declare the variable as "constant", which means unchangeable and read-only:

Example

const int myNum = 15;
myNum = 20; // error

Comments

Popular posts from this blog

Day 2 Talking about computer science 💻

Day 5💻

Day 12 “C comments”