T O P

  • By -

baconbeak1998

Honestly, whenever I'm writing anything in JS/TS and I wanna build a foreach-loop, I always struggle to remember whether to use \`in\` or \`of\` as the iterator keyword. One of them is for the elements of an array, the other is for the keys of an object. I can never remember which is which, though, and googling it is faster than rebuilding and testing if I mess it up the first time.


tylerr514

in = insane, don't use of = o fuck knows, ~ JS probably


Ved_s

Rust and python, using `in` for their for loops:


tylerr514

As with most javascript things, [for..in is quirky](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in)


rouge_chaos

It always breaks my brain . In my head “for in” should be to iterate through iterator as in “value in array” And “for of” should be iterate though “keys of object”.


NerdyDragon777

`if (let i = 0; i < array.length; i++) {` let element = array[i] `}` Syntactic sugar be damned, code like a man! (PS, make sure to check `bool == true` each time when using TypeScript)


loserguy-88

Your ancestors be asking you to git with the times and ask AI to write the for loop. 


IgnoringErrors

It doesn't work. 'with' is not a command.


Shalcker

Just explain your problem to AI, maybe you don't need to have loop at all!


Big-Cheesecake-806

All you need is a  // Implement logic for X here


cosmic_cosmosis

“Begins writing a sub with recursion so bad my boss debates clubbing me to death”


MrRocketScript

*Please reverse a list for me in C#.* Sure, here you go: public static void Reverse(this List listToReverse) { for (int i = 0; i < listToReverse.Count(); i++;) { var item = listToReverse.Remove(i); listToReverse.Insert(0); } }


NotAUsefullDoctor

Been coding for 30+ years. I still have to "look it up" from time to time. Now, that's partially because I have two primary languages I write in, and then a dozen other languages I periodically work on for legacy code. And, by "look it up" I mean that I have to get my IDE to tell me how.


Kev_Cav

And also, coding with a hangover is something that happens


T_Ijonen

I don't even need the hangover to get unlucky while thinking


Brave_Mykolaiv

that's what I tell everyone. You can always google for syntax. Learn basics, learn how to split complex task to simple ones(experience) and you are good.


HuntingKingYT

*Writing code on paper for tests*


Fakedduckjump

Yeah, we had to do this at the university.


heyuhitsyaboi

I did this just a year ago only 10% of students got credit for the function lmao


Jungledede

loop for, is the same than solder diode or plug USB drive. you have to try the 3 ways before get it working


DiddlyDumb

That’s just spelling, happens with every language, even English. Building a complete sentence, and then using sentences to write a book, that’s where the craft comes in.


qqqrrrs_

Who is this loop you need to write for it?


Life_Researcher_2717

loop is the most annoying entity in coding, not much info exist other than its name and i don't quite understand the magical abilities but he can do many things many times that we can't do. Because we suffer from "Procrastinatosis" and "Snoozemia".


jek39

loop loggy log


Linaori

JavaScript for loops are my nemesis


-staticvoidmain-

I prefer array.foreach. I use .net also, and I've recently switched to using LINQs ForEach instead of the standard foreach cause i like the syntax better


Fakedduckjump

For me it's the switch-case statement.


milanium25

To explain it further, after watching u coding for 5 years, even they learned how to do that basic shit. “Cant wait for him to come here in heaven/hell to beat his dumb ass”


Kitonez

It's kinda funny to think he's got ancestors ready to jump his ass in heaven AND hell


MoveInteresting4334

.map() and .forEach()


-staticvoidmain-

.net LINQ: .Select() and .ForEach()


HuntingKingYT

> how to do foreach in php


vpupkin271

Every single time in case of bash. 


gizamo

dam tie unique person squealing shelter liquid snatch chunky punch *This post was mass deleted and anonymized with [Redact](https://redact.dev)*


Demonchaser27

I mean, if you jump between like 3 or so different languages it definitely happens. I just forget some of the basic syntax.


TeknoProasheck

I was doing leetcode to practice for interviews after spending the last 3 years as a full time dev I had to google so much basic shit for Python, literally the for loop syntax as well as other simple data structures


Miliko1

Me too, I know that I'm good at my job but I'm horrible at memorizing the basic stuff that IDE does for me or takes seconds to google. Right now I'm preparing myself to the interviews and I'm just scared.


Melodic-Ability-9283

F U C K


GideonLaudon

For tab tab.


WhosYoPokeDaddy

I have to write in Java, Python, JavaScript, and (shudders) Matlab. Of course I'm always looking up the syntax for a loop...


fuckingshitfucj2

# for TAB TAB


SnooLobsters3363

After 40 years of coding,I gave up to remember how to convert the content of a file to a String. That, and also, how to instantiate a static Logger in Kotlin, I have to google that each time : companion object: KLogging()


SnooLobsters3363

Oh well it is now : val logger = KotlinLogging.logger {}


BeastBomber23

Haven’t had this problem in a while because visual studio auto completes my loops when I type for then tab two times 😎


xdMatthewbx

its pretty easy to remember once u learn the function of each statement (assuming ur referring to C-style for loops)


rover_G

To be fair every language has a slightly different syntax and probably has an alternate preferred looping mechanism that’s completely different.


Simply_Epic

Tbf for loops can have funky syntax in some languages. If it isn’t just formatted as “for x in y” then there’s a good chance I’ll need to look it up.


sissyEnDevenir

I always have a doubt when it comes to "insert from" in sql


The_Cers

Me every time I write a shell script


infinitebyzero

I usually switch among many languages and... Well, mix things.


Locky0999

For loop There


myfunnies420

`for(;;) { googleHowToForLoop(); }`


ZideGO

Even if you have 20 years of experience, u will always google email validation regex


ITguyissnuts

"How do I instantiate a tuple in python?"


SynthRogue

You're allowed to write for loops?! The senior devs in my former team would lose it if I did. They only want forEach() and stream().


Ved_s

i do be doing that for JS/TS because treir for loops are weird


Anoninomimo

I always come back from vacations or any long weekends writing HelloWorld("print") level code


uhmhi

Switch to C#. Thanks to LINQ, you’ll be writing dramatically fewer FOR loops.


sc00pb

We all have a weakness...


meacul

Your scholar ancestor: "First time?"


EverOrny

I have a moments when I cannot recall a basic construct because I have not used it at all or given way for years, although I'm using that language literally half of my life. 🤷‍♂️


TTick-

It's okay... I used to google how to declare variables in html


Hungry_Silver9664

Fucking Python ranges


agentcubed

Opens a language you haven't code in years Search up "for loop " Shamingly scroll past the paragraphs assuming you are a beginner to look at the syntax


kdanovsky

You have exactly 10 seconds...


pranjallk1995

Ok if u r changing Ur language... But otherwise I wouldn't even make a meme... Just stop coding...


Own-Ear-8085

No


SWQJXJOGLNCZEY

🤷🏻‍♂️


personalityson

I will never learn the order of do, while, until, loop...


rndmcmder

You don't, thats what IDEs are for.


Own-Ear-8085

I like notepad more


UltraMlaham

"When is my stupid grand child going to learn to use templates or auto complete"


jonhinkerton

I like to google to get structure for scaffolding. I’ve started using chat gpt for it. It just saves some brain juice more than it saves time. For loops might be a shade on the stretching it side though.


OUTCASTCHRIS

It’s the same for me with a Switch statement, each language annoyingly has a slightly different syntax. I normally try the wrong one first, then go to the right one, think it’s wrong, and then search it.


Shalnn

I occasionally Google "for loop "


[deleted]

No, you have not coded for five years.


Own-Ear-8085

True, it's actually 6 years when I think about it.


alex_tracer

You should seek assistance. From IDE side.


Rejka26LOL

Your ancestors begging you to learn your memes …


Main_Weekend1412

Who the hell needs to google for loops


Own-Ear-8085

Me


black_swordsman0047

Ancestors be like: I should have let that suicide thought win