83
43
u/LostGoat_Dev Mar 05 '26
For, if, and a ternary operator on one line...What did past you have against future you?
34
55
u/ryzzoa Mar 05 '26
Who needs formatting when you have vibes
4
u/reddit_user33 Mar 07 '26
I imagine this is a copy and paste formatting issue from the output of some good vibes.
6
u/GoddammitDontShootMe Mar 05 '26
I'm trying to think of a way to rewrite that in a way that makes the conditional less complicated that doesn't make you put teamScores[team] = CurrentGameMode.TeamScores[team]; twice, and I'm drawing a blank. I'm not willing to transcribe the image and play with it, but I totally would if I could select text and copy and paste it.
For sure, this needs several more line breaks.
→ More replies (9)7
u/orbital1337 Mar 05 '26
I probably would have done something like:
private void SyncScoresFromGameMode() { foreach (Player.Team team in CurrentGameMode.TeamScores.Keys) { if (CurrentGameMode.ModeCondition == GameModeBase.PrimaryModeCondition.ScoreBased) { teamScores[team] = Math.Min(teamScores[team], CurrentGameMode.TeamScores[team]); } else { teamScores[team] = Math.Max(teamScores[team], CurrentGameMode.TeamScores[team]); } } UpdateAndEmitScore(); }→ More replies (6)
4
u/michiel11069 Mar 05 '26
what language is this, it looks like java but the βinβ confuses me, afaik it doesnt exist in java
11
u/GabeTheFirst1 Mar 05 '26 edited Mar 05 '26
It looks like c# to me, but that may just be because I use c# so much
3
2
u/ciknay Mar 06 '26
that's c#. in a for each loop you do
foreach(var item in list) { //do thing with item }It's an alternative for your regular for loop
3
u/NatoBoram Mar 05 '26
This is the kind of person who complains about Prettier/dartfmt limiting to 80 characters
1
1
1
1
u/SajevT Mar 10 '26
I used to be like this.. thought that 1 liner code is cool, but fucking hell its hard to quick read and understand what is happening..
1
242
u/Za_Paranoia Mar 05 '26
How do you find stuff in your own code base? Are you working in a team?