...
The compliant solution replaces 18 with the symbolic constant ADULT_AGE to clarify the meaning of the code.
| Wiki Markup |
|---|
When declaring immutable symbolic values, such as {{ADULT_AGE}} it is best to declare them as a constant in accordance with \[[DCL00-A|DCL00-A. Declare immutable values using const or enum]\]. |
| Code Block | ||
|---|---|---|
| ||
int const ADULT_AGE = 18;
...
if (age >= ADULT_AGE) {
/* Take action */
}
...
if (age < ADULT_AGE) {
/* Take a different action */
}
|
...