Which do you prefer?
Which do you prefer?
Other urls found in this thread:
Middle.
if (condition) {
foo();
}
else {
bar();
}
I do
if (condition) {
foo()
}
else {
bar()
}
change my mind
thenElseIf = \x, y, z => if x then y else z
thenElseIf foo bar
condition ? foo() : bar();
I think you're missing a semi-colon.
semicolins are optional in all 2018 languages
...
Obviously, this
if (condition)
{
foo()
}
else
{
bar()
}
Based
if(condition){
foo();
}
else{
bar();
}
I will, however, skip the braces if it's a one-line statement such as
if(condition)
foo();
else
bar();
if (condition) foo;
else if (condition) bar;
Everything is so much easier when you just don't use curly boys
for (int done = 0; !done; condition ? foo() : bar(), done = 1);
if (condition):
foo
else:
bar
Python3 master race
Out of the three, 1 > 3 >>>> 2. The best one is missing though:
if(condition) foo();
else bar();
if( condition )
foo( );
else
bar( );
if( condition ) {
foo( );
foo2( );
}
else {
bar( );
bar2( );
}
if(condition) {
foo() ;}
else {
bar() ;}
int you = 0xD;
second one, cuz I'm not a piece of shit.
this, best of both worlds
can I get one too
I prefer:
if(condition){foo();}else{bar();}
This how Redpilled men program
what did you mean by this
>2 spaces
absolutely disgusting
>yfw those are all tabs drawn as 2 spaces
>mfw my opinion remains unchanged
(condition) ? foo : bar;
but seriously:
first if there is only one statement
second if you need block of statements
third is retarded
>2 spaces
>gnome
Only the best program like this.
>Not 2 spaces
tsk tsk, you aren't std::hireable yet.
the only logical way is right
The block begins right after the closing parenthesis, so it makes more sense to have the opening brace immediately after.
if (condition) { foo(); } else { bar(); }
if (condition) { Foo(); }
else { Bar(); }
or if both methods return a value which can be reduced to a single type:
var x = condition ? Foo() : Bar();
Middle
Ugly.
except for font. What is the font?
if(condition)
{
foo( );
}
if(condition)
.
{
foo( );
}
The first one shouldn't be used in general so you can add new lines without having to add brackets first.
I strongly prefer the third one, but I'd use the second one if using languages like Java where that's the common style.
Superior OpenSSL style.
>2 spaces
>gnome
>atom
>project(app)
>app
>CanGoWrong
Obv the best
Way too readable. I prefer c?f():b();
>using a curly brace language
Are you retarded user?
If condition
Foo()
Else
Bar()
IBM Plex Mono
u mad bru?
Wtf. Why that plex mono looks so good in that screenshot, but is blury and ugly in intellij (windows... at work)?
>windows
Thre's your problem, 2bh.
Is that the font with the retarded web 3.0, mile long, scroll hijacking, 200MB, progressive download meme website, or is that some other shitty IBM font?
wtf
ibm.com
Scroll down to release feelings.
That's an overengineered website. Always browse for fonts from fontsquirrel.
Meh, for sans and serif, I prefer Lato. IBM Plex Mono is pretty nice, it's my to-go monospace font. I like Fira Mono too though.
if condition {
foo();
}
else {
bar();
}
First never because ambiguity.
Second in most langs, except I don't do } else { because it's ugly
Third in C++ exclusively
came here to post this
used to do
} else {
but it's ugly as shit
The middle. In some cases if I'm going to be doing a single if I do the conditional and statement on the same line. Eg:
if (badArgs) return false;
>weeb-tier font
>the single worst indent style
>new char[99999999999999999]
>1-method class
>T& x
>"\n"
>no -pedantic -Wextra
>.cc
>Atom
>Gnome
>auto main() -> int
>main doesn't return EXIT_SUCCESS
Yah. They don't let me use linux because infosec can't control linux boxes with tools they have and it would be too much work.... corporate nightmare :(
So how do I make it look good on windows?
Install mactype or something, idk. I think java
First, if the command is only one line. Otherwise middle.
if(condition){foo;}
else{bar;}
I used to do this in College just to piss off the retards, never lost points on an exam or whatever for it, now I am kind of attached to it. I'd rather read 50 lines of code written like this than 300 lines of code with 250 lines of single brackets. Having as many of the open and close bracket combinations on the same line also makes it easier to spot missing brackets.
What the fuck is that picture?
>new char[99999999999999999]
My disappointment is immeasurable and my day is ruined.
This is criminal mastermind-tier.
if
(
condition
)
{
foo;
}
else
{
bar;
}
The middle.
its literally c vs c++ vs c#
cmp bx, cx
jeq istrue
cmp ax, cx
jle isfalse
cmp ax, bx
jeq istrue
isfalse:
; do false bit
jmp nextinstr
istrue:
; do true bit
nextinstr:
; carry on
except the part where c and c++ anc c# commonly use right style
Anyone not using the rightmost option with branches longer than 10 lines is an asshole.
Also
if( cond1 ){
if( cond2 ){
/* hundreds of lines */
if( cond6 ){
/* hundreds of lines */
}else if( cond9 ){
/* hundreds of lines */
}
}else if( cond4 ){
/* hundreds of lines */
}
if( cond3 ){
/* hundreds of lines */
if( cond5 ){
/* hundreds of lines */
if( cond12 ){
/* hundreds of lines */
}
}/* if( cond12 ) */
...and so on for many thousands of lines in many hundreds of files.
I wish to cause such people great suffering.
It's an over-engineered font.
You may have learning disability
Reminds me of pic related. Also middle.
I don't.
I use the one wich was chosen for the particular project I'm working on.
first
rly? I have never seen the right style in any c codebase i've worked with
go fmt
Middle is the best
if (condition) {
foo() ;}
else {
bar() ;}
You're allowed to put line breaks between statements you know
>jeq
literally who?
BRRRRRAAAAAPPPPPPP
Left or middle. The right disgusts me on a spiritual level
if (condition) foo();
else bar();
Who the fuck is Colin?
not the one on right
>} else {
This brings the worst in me.
When applicable I like to align my branches like so
if (street) poo();
else if(female) pleaseshowbob();
else printf("thank you sir");
Woops, that's what I get for doing it in the dialog box instead of notepad
if (street) poo();
else if(female) pleaseshowbob();
else printf("thank you sir");