Nah, look at the implementation above:

n <= 4

Means it’s inclusive.

You’re probably referring to some other implementation that doesn’t involve such fine control, like Python where range(4) means [0 1 2 3]

radix
link
fedilink
22Y

Oh yeah, I meant generally. Isn’t it most common if not best practice to say for (i = 0; i < whatever; i++)?

Fair. I guess to accommodate zero-indexing so that it still happens whatever times, not whatever + 1 times.

Create a post

Rules:

  1. Be civil and nice.
  2. Try not to excessively repost, as a rule of thumb, wait at least 2 months to do it if you have to.
  • 1 user online
  • 828 users / day
  • 79 users / week
  • 904 users / month
  • 2.75K users / 6 months
  • 0 subscribers
  • 2.98K Posts
  • 32.1K Comments
  • Modlog