Oh and languages without decent for-each loops are garbage. 😛

Reply to this note

Please Login to reply.

Discussion

like range clauses? yeah, i can't live without those, if you look at most go code the most common two uses for for loops are iterating arrays/maps and forever loops for event handlers with signal channels to break out, or timeouts

I’m not super familiar with ranges as I don’t program in any languages that lean into it. I can give a C# example though.

Say I have a list of strings (List myCoworkers):

foreach (var coworker in myCoworkers)

{

Console.WriteLine(coworker);

}

Does that make sense? No need for an index.

PHP is like

$arr = array(1, 2, 3, 4);

foreach ($arr as &$value) {

$value = $value * 2;

}

Honestly I’m falling in love with PHP. I might cheat on Blazor with it for a while.

its array handling syntax is nice, i also really liked it back in the day... 2003... though its competitor was ASP/VBScript which was ugly as sin

I wrote an entire student management system in VBA in Access. I don’t want to see VB ever again.

LOL I just literally escaped a company to get away from VB. 🤣

Totally worth it, IMHO.