Thought on a single line if like statement?

Wondering what other dev’s think about single line if like statements? Are these a good thing or should they be burned with fire? I like them for the fact that they often shrink 3-5 lines of code into a single line. As a side note, we don’t allow if statements without brackets so no if (a) b() On one hand I feel like it make the code easier to as you can see more of the code on the screen at a time and have less line to take in but I could also see this tripping up less experienced devs or be easier to overlook. Thoughts?

I really like having good syntax so I could not deal with that. For me, as long as I can read the code easily, I’m fine with it

If they are very short, I’m OK with it, just as long as there isn’t anything too clever going on.

function trySomething (test) {
  if(!test) return;

@kam25 is what you’re thinking of similar to the Ternary operator:

The Ternary operator replaces an if / else block in a condensed format. The following is the general format of the ternary operator.

condition ? expr1 : expr2