doing things that make me feel gross

(it's

let i = 0;
for (; i<matches[0].length; i++) {
const idx = i + currentSignal.length;
if (matches[0][idx] !== matches[matches.length-1][idx]) break;
}

)

@monorail I think a while loop would be better but I'm not sure I would give enough of a shit in a code review because either way would look Weird

@wallhackio ??? Iterating i over a range of numbers is a very typical use for a for loop, why are you saying that a while loop would be better?!

@vaporeon_ first I would try to avoid the break by having a more complicated conditional containing the logic put in the if statement

and when I have a gnarly conditional I find it easier to read in a while loop instead of a for loop since the for loop statement contains three sections

but that's all a matter of style, really

Follow

@wallhackio @vaporeon_ i bet you could write this loop in the form for (; [nasty conditional]; i++) { }, which would be the funniest option

@aescling @vaporeon_ whenever I end up writing something like that I tend to convert it to a while loop but that's just a style thing

@wallhackio @vaporeon_ to be clear the one liner was not remotely a serious suggestion, it'd be terrible

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.