DEV Community

Discussion on: Tips on naming boolean variables - Cleaner Code

Collapse
 
thebrenny profile image
Jarod Brennfleck

I don't think it actually should matter how your variable names are prefixed. Particularly with "custom prefixes" if it sounds more correct for the usage of the variable, then use it!

If the boolean is a confirmatory boolean and is reset when accessed, the by all means, use "was": enter.wasKeyPressed.

Just my 2ยข. Otherwise, a fun read! ๐Ÿค™

Collapse
 
crhain88 profile image
Christian

enter.keyWasPressed

Collapse
 
michi profile image
Michael Z

Yes that's true, I added it to the article that going with an exception is better than enforcing a convention where it makes sense.

Collapse
 
liutkin profile image
Volodymyr Liutkin

enter.pressed