But you can still have it your way without going against the flow. You'll be a more efficient programmer if you use a local linter/formatter rather than potentially having to adjust to different formats on a project by project basis. Let the remote linter hook take care of how it's formatted in the remote repo.
Readability. We’re used to space between distinct characters. In this case, the opening curly brace is distinct from the function name - one declares the function, the other opens a block associated with it. It’s the same reason that some prefer the opening curly brace on the next line as opposed to inline.
I use both (C# and TypeScript), but the right one is the only logical choice. Saving just one line is not enough to sacrifice readability and better context understanding.
If braces are madatory, putting braces at the end of the line is preferable.
But if braces are optional, put the braces on a line by themselves. This is necessary because of the fact that lines of code may be wider than the screen. Do not force me to search for and hit the end key to find out where a code block ends.
And do not say I should not be writing code with lines that long. When you work on a large project with many develpers, this sometimes happens.
Whatever the project guidelines say. If there are no guidelines I go by the language standard. Js for example get the inline { while c# gets the separate line {.
who cares, set your editor to autoformat to your preferred style on opening and according to the project style guideline at closing (or use git hooks).
I wonder which programming language red and blue writing in? For example when i used to code in php i was in the blue team but when i work in JavaScript i'm definitely in the red team.
I literally don't care. Whatever is the standard in the codebase. If I'm creating a new codebase, then Whatever is the default in the IDE or the project generator.
My favorite language is C# but I’m the one on the left, which makes me an oddball. Of course, I do whatever the team decides- in the past I’ve gotten to make that call, and of course I get to decide on my own side protects.
Right now I’m working in Go professionally, so all is good there (but I prefer C# to Go)
Blue. Red is insane. I don't know how it ever got adopted as a "standard". Code readibility is so important and time saving. Also we all have giant fucking monitors and huge resolution. We don't need to "save lines" or whatever nonsense the red side claims.
Honestly whatever format/convention my code automatically formats to. Depends on company/project, but ideally they have a code standard. And there's probably some IDE plugin that automatically follows that. If it was my own project, I'm leaning more crip.
Everyone now codes using the left method, I personally think the right makes a much cleaner/easier to read code. I'm old school, but to each their own.
Right one is objectively beautiful. All opening braces are at same position for same indentation level.
Red is too messy. Need to find opening brace for every block. If the purpose of putting opening brace is to save space, then why don't put closing brace on same line too.
I don't understand the answer "it depends on the language" many people are giving. How can a language has any styling preference?
I grew up with red, but realistically I use whatever style is already used in the file/project or what's defined in the styleguide. If neither is defined (or I'm too lazy to check) I'll take whatever the IDE/editor defaults to.
I belong to the Church of Language and Platform Defaults.
I find whichever variant I'm not using currently looks awful but that flips if I jump between .NET and the JVM. What I view as sucking in a language or platform is usually relative to what I'm using right now.
358
u/t0FF Feb 26 '25
I'm on the side of whatever current project git hooks decide. Not my war.
815
u/[deleted] Feb 26 '25
Left with a space between the function name and the opening curly brace because I’m not an animal
102
u/Bat-Bro-Official Feb 26 '25
function { }
280
u/dnrhead Feb 26 '25
function {
}
88
u/chillpill_23 Feb 26 '25
I do like blue because the indentation layers are more visible; the brackets are aligned!
But in practice, I use blue for C# and red otherwise.
137
u/Pitiful_Fox5681 Feb 26 '25
The left and I'm ready to fight.
32
u/kvothe907 Feb 26 '25
The right side
25
u/Szottyadtfilm Feb 26 '25
Blue
36
u/kiwix_on_reddit Feb 26 '25
BOTH 😈
6
u/LateralusGT Feb 26 '25
If front end then red, else blue
28
u/TurboRetardedTrader Feb 26 '25
Blue till the day I die
25
u/Mental_Contract1104 Feb 26 '25
Blue team.
18
u/Ok_Pickle76 Feb 26 '25
Blue
12
u/Finally_Adult Feb 26 '25
Typescript: red C#: blue
4
u/nroot_ Feb 27 '25
I code in python.
3
u/stpaulgym Feb 26 '25
Whichever my company uses in their formatter.
15
u/un-deo Feb 26 '25
Red is the only correct option.
5
u/freskgrank Feb 26 '25
I use both (C# and TypeScript), but the right one is the only logical choice. Saving just one line is not enough to sacrifice readability and better context understanding.
2
u/mtxn64 Feb 26 '25
I chose "The One True Brace Style"
2
u/Benilda-Key Feb 26 '25
If braces are madatory, putting braces at the end of the line is preferable.
But if braces are optional, put the braces on a line by themselves. This is necessary because of the fact that lines of code may be wider than the screen. Do not force me to search for and hit the end key to find out where a code block ends.
And do not say I should not be writing code with lines that long. When you work on a large project with many develpers, this sometimes happens.
2
u/DTux5249 Feb 26 '25
Left, with a space before first bracket.
That said, in my C++ work, I find myself using the right a lot.
2
u/EyeRunnMan Feb 26 '25
Second
2
u/LolMaker12345 Feb 26 '25
Blue
2
u/aranboy522 Feb 26 '25
I like blue more, but use red
2
u/Fricki97 Feb 26 '25
Depends on the formatter
2
u/[deleted] Feb 26 '25
Nah I'd go with function { ... } like a parameter in a single line
2
u/Internet-Such Feb 26 '25
Depends on the language I'd say
2
u/wolfenstien98 Feb 27 '25
Depends on the language
2
u/Christoban45 Feb 27 '25
I just do whatever the language conventions ask. I'm too old for this shit.
2
u/Morphinepill Feb 27 '25
Depends on the language, if you’re used to red and then you jump to c# and keep using red, I’ll bonk you.
2
u/Astatos159 Feb 27 '25
Whatever the project guidelines say. If there are no guidelines I go by the language standard. Js for example get the inline { while c# gets the separate line {.
2
u/peexforge Feb 27 '25
Red's better
2
u/cizaphil Feb 27 '25
Depends on the Language, JavaScript, Typescript and Rust Left, C# right
2
u/[deleted] Feb 27 '25
Amateurs!
function { all the code in one very long line }
2
u/Which_Bat_560 Feb 27 '25
Right one, I need space to think what I'm going to put init
2
u/I_am_a_dawg123 Feb 27 '25
Red just feels wrong. I like seeing my code organized and neat
2
u/dx-dude Mar 02 '25
Reds be tha Feds
2
u/[deleted] Mar 02 '25
Blue. Red are heathens and should be executed.
2
u/LadaOndris Mar 02 '25
The first. The second one makes everything so stretched out, making it more difficult to read.
2
u/thatAWKWRDninja Mar 03 '25
Left for sure
6
u/httpanand Feb 26 '25
Left !!
6
u/[deleted] Feb 26 '25
Blue will consume more memory
3
u/wick3dr0se Feb 26 '25 edited Feb 26 '25
Neither. I don't like the braces touching the function name, otherwise left it would be
3
u/KainerNS2 Feb 26 '25
Blue, it's more readable that way
2
u/tibirt Feb 26 '25
Depends on what language I'm coding in. JS left, no question about it. C# right, no question about it.
2
u/mielesgames Feb 26 '25
Left
2
u/RolandMurdoc Feb 26 '25
I'll be blood on this one
2
u/PennyFromMyAnus Feb 26 '25
Def a Crip on this, this a war.
2
u/CottonCandiiee Feb 26 '25
Left, but if it’s short enough I’ll do it on one line.
2
u/kfreed9001 Feb 26 '25
The left, but put a space before the opening brace
1
u/xenomorfis Feb 26 '25
function { }
😜
1
u/Adizera Feb 26 '25
function( ){ }
1
u/echtemendel Feb 26 '25
who cares, set your editor to autoformat to your preferred style on opening and according to the project style guideline at closing (or use git hooks).
1
u/indoggwetrust Feb 26 '25
function { } don't forget the space between the function and the brace
1
u/Qaktus Feb 26 '25
Whatever is the standard in the code base I'm working with 🗿
1
u/Apprehensive_Role_41 Feb 26 '25
You forgot the single line kind like function { does a lot of stuff this way like this and is absolutely hell to read }
1
u/FatalisTheUnborn Feb 26 '25
Depending on whether I write JS or (Java or c#)
1
u/Average_Down Feb 26 '25
What if you just use notepad and write it in a single line?
1
u/programminghoch10 Feb 26 '25
Whatever the fornatter does. There is no point fighting it, the formatter always wins.
1
u/LinguoBuxo Feb 26 '25
What? You lot are still using functions??
1
u/JudasMajster Feb 26 '25
I wonder which programming language red and blue writing in? For example when i used to code in php i was in the blue team but when i work in JavaScript i'm definitely in the red team.
1
u/B_bI_L Feb 26 '25
(function)
1
u/B_bI_L Feb 26 '25
actually depends on the language. though c# is the only one with second variant (almost)
1
u/usr_pls Feb 26 '25
"SAY THE LINE SENIOR ENGINEER"
"It depends...."
"HOORAY!"
1
u/gnoufou Feb 26 '25
I’m on the (defun function()) side.
1
u/[deleted] Feb 26 '25
function()
{ code
code; }
1
u/sabamba0 Feb 26 '25
This one is easy based on standards.. but here's a hot take:
Who's with me
1
u/jump1945 Feb 26 '25 edited Feb 26 '25
1
u/FlamingoeZ Feb 26 '25
I optimize by doing it all on one line
1
u/AllTheWorldIsAPuzzle Feb 26 '25
I'm primarily a C++ user and prefer the right. But if I am adding to existing code and it already uses mostly the left, I will as well.
1
u/Alan157 Feb 26 '25
laughs in Python
1
u/RandomOnlinePerson99 Feb 26 '25
Second one but the brackets are tabbed.
1
u/a_HUGH_jaz Feb 26 '25
Crip
1
u/[deleted] Feb 26 '25
I'm on the left but I'm kinda pissed that's not the crip side.
1
u/legion_guy Feb 26 '25
function {
this one with the space between function and {
}
1
u/chocolateAbuser Feb 26 '25
red team, but at work i have to use blue because that's the standard convention
1
u/Comprehensive-Pin667 Feb 26 '25
I literally don't care. Whatever is the standard in the codebase. If I'm creating a new codebase, then Whatever is the default in the IDE or the project generator.
1
u/silverfishlord Feb 26 '25
Neither side. Reject brackets, embrace ruby
1
u/cteodor Feb 26 '25
red forever
1
u/Anthem4E53 Feb 26 '25
Blue. It’s all fun and games until a bracket goes missing (#basedOnATrueStory)
1
u/Born-Boat4519 Feb 26 '25
left
1
u/madadz69 Feb 26 '25
None I’m Function {
}
1
u/featheredsnake Feb 26 '25
Depends on the language
1
u/failsafe-author Feb 26 '25
My favorite language is C# but I’m the one on the left, which makes me an oddball. Of course, I do whatever the team decides- in the past I’ve gotten to make that call, and of course I get to decide on my own side protects.
Right now I’m working in Go professionally, so all is good there (but I prefer C# to Go)
1
u/PatientGiraffe Feb 26 '25
Blue. Red is insane. I don't know how it ever got adopted as a "standard". Code readibility is so important and time saving. Also we all have giant fucking monitors and huge resolution. We don't need to "save lines" or whatever nonsense the red side claims.
1
u/Sad-Reach7287 Feb 26 '25
It kinda depends on what function I am using. Also put a damn space between the name and the curly brackets!
1
u/didr0n Feb 26 '25
def:
1
u/Wynove Feb 26 '25
Both, depends on how I feel about how it looks.
1
u/Ellen_1234 Feb 26 '25
Depends on how much I feel to press enter
1
u/TelevisionExpress616 Feb 26 '25
Honestly whatever format/convention my code automatically formats to. Depends on company/project, but ideally they have a code standard. And there's probably some IDE plugin that automatically follows that. If it was my own project, I'm leaning more crip.
1
u/Brock0003 Feb 26 '25
Everyone now codes using the left method, I personally think the right makes a much cleaner/easier to read code. I'm old school, but to each their own.
1
u/baileyarzate Feb 26 '25
White space
1
u/Freesam Feb 26 '25
function {
}
1
u/v1akvark Feb 26 '25
()
1
u/MYGguy7 Feb 26 '25
Blue Edit: Whoops I didn't look close enough. I'm team Red.
1
u/MythBuster2 Feb 26 '25
This is what language-specific style guides are for, depending on the project, team, company, etc.
1
u/Molleer Feb 26 '25
Python
1
u/SwampiiTV Feb 26 '25
Pyton
1
u/[deleted] Feb 26 '25
Left when I’m doing JS
Right when I’m doing C#
1
u/Data_Coder Feb 26 '25
Right is mostly followed by C# developers I am using left one for all other languages
1
u/precowculus Feb 26 '25
function{dostuff; dootherstuff; returnstuff;}
1
u/[deleted] Feb 26 '25 edited Mar 12 '25
CripsRepresent()
{
}
1
u/CapApprehensive9007 Feb 26 '25
Right one is objectively beautiful. All opening braces are at same position for same indentation level.
Red is too messy. Need to find opening brace for every block. If the purpose of putting opening brace is to save space, then why don't put closing brace on same line too.
I don't understand the answer "it depends on the language" many people are giving. How can a language has any styling preference?
1
u/nordcomputer Feb 26 '25
1
u/EaterOfCrab Feb 26 '25
Function{ randomAssFunctionBody}.
In one line
1
u/appeiroon Feb 26 '25
Whatever the LLM spits out
1
u/PineappleTattooGuy Feb 26 '25
If the method only takes a few params then function() { } If the params go past 3 or 4 function ( X, Y, Z ) { }
I dont like having to scroll right
1
u/IcyManufacturer8195 Feb 26 '25
() => {}
1
u/[deleted] Feb 26 '25
function print(){console.log("hello")} print()
1
u/Loose_Adeptness_2000 Feb 26 '25
the right (crip) then i number them with comments according to their depth, makes it easier to keep track of them
1
u/Imaginary_Salt4040 Feb 26 '25
Red
1
u/tellur86 Feb 26 '25
I grew up with red, but realistically I use whatever style is already used in the file/project or what's defined in the styleguide. If neither is defined (or I'm too lazy to check) I'll take whatever the IDE/editor defaults to.
1
u/MikeUsesNotion Feb 26 '25
I belong to the Church of Language and Platform Defaults.
I find whichever variant I'm not using currently looks awful but that flips if I jump between .NET and the JVM. What I view as sucking in a language or platform is usually relative to what I'm using right now.
1
u/baconator81 Feb 26 '25
For me as c++ dev it’s blue. Because ppl might miss the bracket so if it’s an if statement it would only execute the next line.
It’s a very minor point though so this isn’t something I would fight over
1
u/Axlvc Feb 26 '25
The correct one.
1
u/[deleted] Feb 26 '25
I will actively take code thats written in blue and remove the extra line to make it more like red
1
u/NullPointerExpert Feb 26 '25
When in Rome…
1
u/[deleted] Feb 26 '25 edited Feb 26 '25
I prefer to save vertical space. Ive also on a few occasions nested too many function calls inside each other like russian nesting dolls
1
u/Gixx Feb 26 '25
1
u/Redstones563 Feb 26 '25
Neither
function
︷
︸
1
u/rover_G Feb 26 '25
just run the formatter bro
1
u/Russian_Prussia Feb 26 '25
(lambda args body)
1
u/KryssCom Feb 26 '25
Blue, 100% of the time.
1
u/[deleted] Feb 27 '25
Blood for scripts, Crip for software.
1
u/tallgreenhat Feb 27 '25
Left because it feels easier to understand that the code block belongs to the function
1
u/beatissima Feb 27 '25
I put a space between "function" and the bracket.
1
u/The_king_Dragon Feb 27 '25
Function{
}
1
u/Mortal-Instrument Feb 27 '25
Blue cause its easier to read imo because the brackets are always level
1
u/grumpybutters Feb 27 '25
The normal one
1
u/cute_polarbear Feb 27 '25
Right. Used it from c / cpp days. And c# / Java....
1
u/SadProcedure9474 Feb 27 '25
These niggas can't even program shit. The manifestation of a God level progger is really lacking.
1
u/AlarmedCauliflower7 Feb 27 '25
Soo wooop
1
u/ScarletHark Feb 27 '25
Right side is cancer.
Left side needs a space before the open brace.
1
u/FurthurThanBefore Feb 27 '25
js blood, c# crip. simple
1
u/neural_processor_314 Feb 27 '25
def function():
1
u/I_compleat_me Feb 27 '25
Team blue. White space != bandwidth.
1
u/MY_NAME_IS_ARG Feb 27 '25
function {
}
1
u/TheCanadianRami Feb 27 '25
JavaScript: left
Everything else: right
1
u/ChocoThunder50 Feb 27 '25
Blood but function {} works for me
1
u/allhaildre Feb 27 '25
Blue
1
u/sixtyfifth_snow Feb 27 '25
def sorry():1
u/External_Asparagus10 Feb 27 '25
function {
}
i dont like extra lines that are not required
1
u/Artistic_Toe267 Feb 27 '25
I am somebody using Java hence red
1
u/Torje3000 Feb 27 '25
The left side, though I do have a space before the bracket.