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.
I would call the variable
beforeLast
.hasFollowingItems? or hasFollowingXXXXs where XXXX is whatever the item in your list is?
isPenultimateOrPrior
isBeforeEnd
A simple semantic name would be
last
. This would allow code always positive code like:Haskell uses
init
to refer to all but the last element of a list (the inverse oftail
, basically); wouldisInInit
work, or is that too opaque?