28
A constant is like a variable, but its value never changes. Think of it like the date of your birthday or the value of Pi. Once it's set, it stays that way.
In code, we use them for things that should remain fixed throughout the program—like the maximum number of attempts for a password or the name of a database.
It helps prevent accidental changes and makes the code easier to read. By convention, we often write their names in ALL_CAPS so they stand out.
Log in to add a comment.