8 ms·
It's a fair point, but the style guide is meant to be illustrative. The former example is indented the way longer lines might very well be e.g. if your filter
by pixelmonkey 11y ago
It's a fair point, but the style guide is meant to be illustrative.
The former example is indented the way longer lines might very well be e.g. if your filter clause were a 2-part bool, you might not be able to fit it in a one-liner. The indentation also clarifies the difference between it and the imperative example above it.
The latter example is a rewrite of code written with 2 nested if statements, so the indentation serves to show that now the two nested statements were incorporated into the bool evaluation. If I made it a one-liner, someone might make the argument that the nested version is "more readable", but as written all you can say is that the single-if version is "less nested", which is the point I was trying to get across.