Show newer

@vaporeon_ some people don't like the ++ shit because it leads people to make logical errors, which I will admit just happened to me in the recent holly for loop hellthread

@vaporeon_ @aescling @monorail also this thread makes me certain that "I'm not sure I would give enough of a shit in a code review because either way would look Weird" was the right answer all along

@vaporeon_ @aescling @monorail yeah that's what i would do (actually I would do ++idx, ++i but it objectively doesn't matter)

@monorail @aescling this thread is justifying my current software unemployment

@monorail anyway I was nice and comfy in my bed and this made me get up to use my computer so every one of my followers better favorite this

just found out about original sin 💀 come on man

@monorail here's my final answer:

let i = 0;
for (
let idx = currentSignal.length;
i < matches[0].length && matches[0][idx] === matches.at(-1)[idx];
idx += i++
);

@vaporeon_ I was not aware of this feature!

Apparently you can create "labelled statements" for anything considered a "statement", for which I believe include for, while, switch, and if/else if/else

@vaporeon_ after a little searching someone in 2009 made a preprocessor for the language that adds goto but the library can only be found in an internet archive page and the internet archive is currently down

@vaporeon_ @alas oh I wouldn't have thought to do it with a do while, this is neat

my evil code golfing brain wants the i++ snuck into the previous line but that kind of thing tends to get you in trouble

by the way you also need i<matches[0].length in the conditional

@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

Show older
📟🐱 GlitchCat

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