DEV Community

Discussion on: Stop waving the wand of magic numbers

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

That's not creative, that's "clever".

I frown on clever coding.

I wonder if other variables were named iii, iv, v, etc?

Collapse
 
jenc profile image
Jen Chan

Is that ... a spread operator?

Thread Thread
 
drbearhands profile image
DrBearhands

nah, [...] is often used to indicate that some part was cut from a quote. I guess it doesn't translate well to code blocks.

Thread Thread
 
mortoray profile image
edA‑qa mort‑ora‑y

I often do three vertical dots for this:

trailing_code
.
.
.
next_important_code
Collapse
 
drbearhands profile image
DrBearhands

the ii name was my own addition. I was under the impression this was fairly common for indexed array iteration.

Thread Thread
 
mortoray profile image
edA‑qa mort‑ora‑y

I don't think I've seen it before. I might have blocked out the memory. If I need a generic variable I just use i, or j, but I prefer giving them better names when possible, like row, or x, or item_ndx.

Thread Thread
 
drbearhands profile image
DrBearhands

Oh, ii is often used rather than i for iterators because it's easier to text search. Then again if you have to search for the iterator you might be doing something wrong.

Thread Thread
 
mortoray profile image
edA‑qa mort‑ora‑y

I don't think I've ever searched for an iterator variable.