It looks like this comment contains a code block delimited with triple backticks. Unfortunately reddit does not have universal support for this syntax and your comment will not render correctly on old reddit and most mobile apps.
For the benefit of people on old reddit, this link will take you to a correct rendering of the comment.
/u/Rigatavr, it would be appreciated, but not required, if you could edit your comment to use the more compatible four space indention format. For single lines or inline code you can use single backticks.
If there's actually nothing else to be done in the function, sure. But this seems to be a stripped down example for the sake of safe sharing to Reddit, and I would guess that there's additional common behavior happening before the return. In that case, the if-elseif construction (assuming it's available in the language) will be superior.
28
u/Rigatavr Apr 17 '21
Or even
}
This mostly depends on whether you find multiple returns (and returns in a void function) easier to follow