3 ms·
Short variable names are fine if the variable exists for a short time (eg: if the variable lives more than 5 lines of scope then use a longer variable name). B
by engtech 14y ago
Short variable names are fine if the variable exists for a short time (eg: if the variable lives more than 5 lines of scope then use a longer variable name).
But don't use single character variable names. We've all gotten in the habit of using i,j,k as loop variables, but ii,jj,kk are absolutely a better choice for the simple reason that you can use any text editors' search function to find "ii" without any false matches, but "i" will have you searching all over the place.
TL;DR - using "ii" instead of "i" makes it easier to maintain code.
- actsasbuffoon 14y agoDo you think it's likely that you're going to want to search for those short-lived variables? I think short variable names being less likely to create false-positives when searching is a feature, not a bug.