Which do you prefer

This

if(a === b) {
  blah
}
else {
  bleh
}

or this

if(a === b) {
  blah
} else {
  bleh
}

Personally, I prefer the second one as it takes up less space and looks a lot cleaner and cooler

The second. It takes up fewer lines than the other. And if you do the first you are a monster

3 Likes

both look horrible lmao

I would do this:

if (a === b) {
  blah
}

else {
  bleh
}
1 Like

I agree with @JayAySeaOhBee14, just the fact that I have a different opinion. THIS is my superior looking:

if (a == b) {
	blah
} else {
	bleh
}
2 Likes

I prefer option C: Python.

# Smaller than your JS
if a == b:
  blah
else:
  bleh
# Even smaller
if a==b:blah
else:bleh
# Actually bigger than the previous option but one line
exec("if a==b:blah\nelse:bleh")
2 Likes

This is the clean way. Any other way is less readable and should be avoided except for some idiomatic code like comprehensions or ternary assignments. If you like compressing codes in few lines, learn perl and have fun with unreadable tiny unreadable scripts.

2 Likes

Fi
Fir
Firs

Firs Second of course

I prefer a===b:blah?bleh actually.

Actually though I prefer the 2nd option : )

2 Likes

That is basically the 2nd option with highlightings.

1 Like

that is a ternary assignment, for IfThenElse the second is more readable and preferred. And readability is something best learnt early …

1 Like

Yea I actually like the 2nd one best, but something about minified javascript just always looks cool.

1 Like

My preferred syntax looks something like this

if 
(a === b) 
{blah} 
else 
{bleh}
1 Like

coding meme

3 Likes

I prefer this:

if (a === b) {
    blah;
} else {
    bleh;
}
2 Likes

I guess you don’t what’s the difference between == and ===:face_with_diagonal_mouth:

1 Like

I prefer the second one!

2 Likes

Maybe well be as the different is subtle. But if == is probably the one leading to less surprised for people not understanding that == != ===

3 Likes

I always thought they were the same until 3h ago…

1 Like

Nope. Small bit difference and can surprise when not known.

2 Likes

I feel attacked…obviously the first is the best.

This is why y’all ain’t TL3. First one is the true way to program.

1 Like