DEV Community

Discussion on: local constants vs comments

Collapse
 
sfiquet profile image
Sylvie Fiquet

Coming from C/C++, I'd go for option 2 but in all caps to show at a glance that it's a hardcoded value. Not sure if that's also a convention in C#.

const int CORRECT_TYPE = 2;
return inputType == CORRECT_TYPE;

Collapse
 
peledzohar profile image
Zohar Peled

I'l all for all cups for constants, however standards where I work demand pascal casing for constants (for some made-up b.s reason), so I got used to it...