in programming, and in mathematics, it’s always been weird to me that frequently paired variables are basically the most easily confused for one another pairs, especially when written quickly or sloppily.
- i and j
- x and y
- m and n
I think your problem is with the alphabet, friend
M as in mancy
I always like to joke in coding interviews that I really like to make variable names as long as I can so they are very precisely named. Then when I get to a double nested loop I hit them with iterator and jiterator instead of I and j
i for index or iteration. Using j, k, l… in loops signals (imho) that there is most likely an outer loop and the one using j, k, l are nested. x and y of course are carthesian coordinates . n is used as amount of substance in SI-unit-system, m is mass, maybe thats why it is used as amount of items in a set (Menge).
Programming computers have started to solve mathematical problems and math already used these symbols for centuries(?), so why you should change them? They are well established even in simple school mathematics. And at the end of the day a computer is nothing more than a calculator.
x = “Am I a joke to you?”;
Usually variables like that can be avoided with itterators nowadays. If they can’t I like to use
idx
, if they are nested I name them after what they index, likeidx_rows, idx_cols
.I haven’t used I and J after college
I’ve hardly ever looped over indices after college. For-each loops solve 99% of real-world problems in a better way.
I prefer to use K in for loops, but that’s just me.
Hi there! Your text contains links to other Lemmy communities, here are correct links for Lemmy users: !programmerhumor@lemmy.ml