Search code examples
booleancoding-stylenaming-conventions

Naming Conventions: What to name a boolean variable?


I need a good variable name for a boolean value that returns false when an object is the last in a list.

The only decent name I can come up with is 'inFront', but I don't think that is descriptive enough.

Another choose would be 'isNotLast'. This is not good practice though (Code Complete, page 269, Use positive boolean variable names).

I am aware that I could change the variable definition. So true is returned when an object is the last and call the variable 'isLast', however, it would make this task easier if I had the first explanation.


Solution

  • isBeforeTheLastItem
    
    isInFrontOfTheLastItem
    
    isTowardsTheFrontOfTheList
    

    Maybe too wordy but they may help give you ideas.