5SpeedDeasil@lemmy.world to Memes@lemmy.ml · 1 year agoRandom internet people explaining math better then math teacheri.imgur.comimagemessage-square200fedilinkarrow-up11.73Karrow-down161cross-posted to: math@lemmy.world
arrow-up11.67Karrow-down1imageRandom internet people explaining math better then math teacheri.imgur.com5SpeedDeasil@lemmy.world to Memes@lemmy.ml · 1 year agomessage-square200fedilinkcross-posted to: math@lemmy.world
minus-squareoutdated_belated@lemmy.sdf.orglinkfedilinkarrow-up13·1 year agoNah, 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]
minus-squareradixlinkfedilinkarrow-up2·1 year agoOh yeah, I meant generally. Isn’t it most common if not best practice to say for (i = 0; i < whatever; i++)?
minus-squareoutdated_belated@lemmy.sdf.orglinkfedilinkarrow-up2·1 year agoFair. I guess to accommodate zero-indexing so that it still happens whatever times, not whatever + 1 times.
Nah, look at the implementation above:
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]
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, notwhatever + 1
times.