You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In writing if/else statements, I would normally prefer to place the short shorter block in front, and leave the larger block behind. If it's written the other way round, the reader might miss the else clause.
For example,
if ! valid(item) do
{:error, :invalid_item}
else
... processing ...
...
{:ok, result}
end
It is not every time we have the opportunity to rewrite the valid/1 method to invalid/1 such that there isn't a negation in the if clause. And we probably agree in not using unless/else even in such situations.
The text was updated successfully, but these errors were encountered:
In writing
if/else
statements, I would normally prefer to place the short shorter block in front, and leave the larger block behind. If it's written the other way round, the reader might miss theelse
clause.For example,
It is not every time we have the opportunity to rewrite the
valid/1
method toinvalid/1
such that there isn't a negation in theif
clause. And we probably agree in not usingunless/else
even in such situations.The text was updated successfully, but these errors were encountered: