336
you are viewing a single comment's thread
view the rest of the comments
[-] 9point6@lemmy.world 1 points 1 year ago

The world where the convention is i

[-] hellishharlot@programming.dev 1 points 1 year ago

What's incoherent about the first one? Why is index bad beyond standards

[-] 9point6@lemmy.world 1 points 1 year ago

It's not incoherent, it just takes a tiny bit more effort to mentally parse as it's not a stereotypical for loop. Maybe it's just me, but let me try and explain

With the i example if you're familiar enough with a language, your brain will gloss over the unimportant syntax, you go straight to the comparison and then whether it's incrementing or decrementing.

With the other example, the first my brain did was notice it's not following convention, which then pushes me to read the line carefully as there is probably a reason it doesn't.

I'm not saying it's a huge difference or anything, but following code conventions like this makes things like code reviews much easier cumulatively.

this post was submitted on 01 Sep 2023
336 points (96.4% liked)

Programming

16991 readers
238 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS