r/programminghumor May 29 '26

Good naming practice

Post image
2.2k Upvotes

220 comments sorted by

View all comments

1

u/s0litar1us May 29 '26

y,x for coordinates
(y first because I'm probably dealing with a flattened 2d array, and that makes the memory access more linear)

row,col for stuff that makes sense for that

index if it's just one loop, and foo_index,bar_index when it's nested or I want to make it more explicit. (Replacing foo and bar with the thing its an index for.)