I recently asked a question that was closed as a dupe of two other similar, but not related questions. I edited my question to clarify why it is not a dupe, however I was too late and the question was closed.

Please reopen the question as it is not a dupe, even if the other questions (which I obviously read before posting) address similar concerns.

  • 1
    per my recollection, only 3 of 5 votes were for duplicates; two votes were for opinion based. You may consider addressing concern of "opinion-based" voters in this appeal to reopen
    – gnat
    Jul 1, 2015 at 16:51
  • @gnat: Thank you, I edited the question to address that. Though, to be fair, a significant portion of the questions on this particular SE site suffer from the opinion-based issue. I think that it is more inherent in this SE than in other SE sites.
    – dotancohen
    Jul 1, 2015 at 16:58
  • 1
    I agree the dupes were not dupes at all, even if its opinion-based (it probably is/'was) those dupes need to go even if its just to keep things tidy (a better reason would be: not to encourage people closing because they read the title and thought "that'll do")
    – gbjbaanb
    Jul 1, 2015 at 17:09
  • 1
    I voted for a dup initially, then you pointed out that it wasn't a dup and specified it further. If this was earlier, I would have voted as primarily opinion instead. I don't believe it should be reopened, unless that is done to immediately change it to closed as primarily opinion.
    – user40980
    Jul 1, 2015 at 18:16
  • 3
    @dotancohen most questions have some measure of opinion to them: the issue is whether an answer is primarily opinion-based as opposed to fact-based. While the vast majority of developers with at least two brain cells agree that "optional braces are not optional" and "one statement per line," any question about this topic is still primarily opinion-based. Any way you code that if is technically correct as long as we are quibbling about style and not the machine/byte code the compiler emits.
    – user22815
    Jul 2, 2015 at 11:11

2 Answers 2


I agree it is not a duplicate of the questions specified, and have voted to reopen.

You are asking about what cases you should be using single-line if statements, and provide a good example of of die/exception cases.

The other two questions linked ask about using curly braces or not in an if, or ask about multiple lines of code vs every code statement on it's own line. Neither ask the same question, nor get you the same answer that you got on your answer.

I hope a few others vote to reopen as well, but if not you can always flag for a moderator in a few days as I've always found it's much harder to get things reopened on this site than to close them, and moderators are often needed to step in before reopen votes start to expire.

As for those claiming it's an "opinion-based" question, well the majority of questions/answers on this site could be called "opinion-based". The purpose of that close reason is to stop questions where everyone's answer/opinion could be right (for example, "What's your favorite editor theme"). I do not think this applies in your case because you provided a specific criteria for your answer (readability, maintainability, extensibility, etc) and I don't think there are that many answers to your question that we need to worry about this question descending into a list of "here's my preference" answers.

  • You've got an answer that starts out "I always prefer the version with braces" already. How many more do you need before it is clear that question is easily construed to be an opinion poll?
    – user40980
    Jul 4, 2015 at 14:25
  • 3
    Unfortunately I have to disagree. There are quite a few SEs like The Workplace which rely very heavily on the premise that there is a large gap between "primarily opinion-based, therefore unanswerable" and "opinion-based yet perfectly answerable." The question under discussion is clearly in the former camp because it's impossible to offer any experience or justification for an answer beyond "X, Y, Z found this more/less readable."
    – Ixrec
    Jul 4, 2015 at 14:53
  • @MichaelT I don't find anything wrong with that providing the answer back up their opinion with an explanation of why that is the case. Which in this case, the answerer did. :)
    – Rachel
    Jul 6, 2015 at 15:34
  • "I come from a perl background and if ($foo) next; is perfectly acceptable." --- "I come from a Java background and we have a strict style guide. You always need braces and simple if statements are forbidden" --- "I come from a lisp background and such questions are meaningless". In order to avoid it getting closed again (it has 3 close votes as of this writing), the question needs to be modified so that those examples are not acceptable. This may invalidate existing answers.
    – user40980
    Jul 6, 2015 at 15:39
  • @MichaelT I don't see any answer that says anything like that, upvoted or otherwise. The one that begins with "I prefer the version with braces" is this one, and it gives a few solid reasons for why that is. Until we start getting upvoted answers that provide nothing more than an opinion with no facts to back it up, I'd say the question is fine. I actually like the question (and have upvoted it) as I was interested in the specific topic it covers.
    – Rachel
    Jul 6, 2015 at 15:53
  • 1
    They are valid answers (with exposition) to the existing question. They are all equally correct that answer the question. They are also completely opinion and anecdotal and lead to the question itself being primarily opinion or too broad. The underlying issue in the question that it doesn't sufficiently discourage or prevent these answers hasn't been addressed. Primarily opinion covers more than the GTKY style questions. "Is some style bad?" also primarily opinion.
    – user40980
    Jul 6, 2015 at 15:56

The core question to the problem is one that needs work. I see it has been reopened, but the issue of it being primarily opinion has not been addressed or resolved.

Are there any other "good" uses for single-line if statements? How strictly should the practice be avoided? Note that I am explicitly asking about the lack of an indented line to indicate that a condition may or may not occur, I am not asking about the use of braces. Although I would appreciate all opinions in the comments, answers should address objective reasoning, such as maintainability or extensibility of code.

This text needs to be changed to not be a poll for suggestions of enables of 'good examples' for single line if statements. Furthermore, the second question is completely opinion. There is no problem to be solved. I will have different answers than others that differs only on my beliefs - not on objective architectural or design principles.

Without resolving this, we get answers such as this:

I always prefer the version with braces.

  1. If I don't always use the braces, then I may forget to put them when there is more than one statement in the block.
  2. IDEs used by other team members can reformat the code automatically to move the statement to the new line, thus making it much more error prone in the future.
  3. Merging the code across the branches is more error prone if the if statement is a conflicting spot. The probability for error is even higher if the person doing the merge is not completely familiar with the merged changes.
  4. A statement not-belonging to the block may be included in it later by mistake (I add new statements to the block, so I need to add braces, but because of indentation or similar visual effects I also include a statement that should be left out of the block).

Where it implicitly encourages people to answer with "I prefer..."

While it may be possible to resolve these issues, the question should not have been reopened prior to removing the polling nature.

  • 1
    Thank you Michael. We both have the same concern (I am the OP). Further down the question I mention that although I would appreciate all opinions in the comments, answers should address objective reasoning, such as maintainability or extensibility of code. In fact, the accepted answer does give an objective answer with a clear advantage to the coding standard with indentation.
    – dotancohen
    Jul 4, 2015 at 15:58
  • 1
    @dotancohen while gnat has protected it, it has been the general experience that many users will jump on the bike shed type questions and answer it as if it was a poll - either providing you with short code snippets of their opinion of "'good' uses for single line if statements" or answer the "how strictly should the practice be avoided" without actually addressing the design / architecture issues that are raised.
    – user40980
    Jul 4, 2015 at 16:07
  • @MichaelT like this? :)
    – gnat
    Jul 5, 2015 at 1:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .