Naming conventions for "number of foos" variables

Viewed 24866

Let's suppose that I need to store the number of foo objects in a variable.

Not being a native English speaker, I always wonder what's the best (= short and immediately clear) name for that var.

foo_num? num_foo? no_foo? foo_no? or something else?

The full name should be number_of_foos, but it's a bit verbose.

What's your favorite and why?

10 Answers

I use for the quantity of somethings: somethingCount (something_count)

I use for the sequence number of somethings: somethingIndex (something_index), because the "number" word is ambiguous (it means the quantity and the sequence number)

Related