I recently answered a question, and I must admit that another user posted an answer superior to mine.

Although my answer is correct, I thought about deleting it. What is the suggested behavior?

Should I leave it and simply be a good sportsman by upvoting the other answer? Should I delete my answer so that further viewers only see the best solution?

  • 2
    Your answer seems marginally different, it might make sense to leave it. Either way, if you think the other answer is good I'd give it an upvote – Richard Tingle Mar 26 '14 at 15:27
  • Feel free to delete. There is another answer posted a minute after yours with the exact same code that its author deleted, probably when seeing existing answers. :) – Shadow Wizard is Vaccinating Mar 26 '14 at 15:27
  • 1
    Whether leaving your answer or deleting it, if other answers are good, upvote them. Active voting by informed, reasonable people is the best thing for the site. – T.J. Crowder Mar 26 '14 at 15:46
  • @ShadowWizard, I don't see my question as a duplicate, as my answer on SO is not the same as the answer of the other user. – davegson Mar 26 '14 at 15:50
  • 2
    @TheChamp so if not the same, this part of the answer also answers your case: However, if your answer is unique or offers a different (hopefully correct) perspective, then leave it in the mix hence still fitting as duplicate. :) – Shadow Wizard is Vaccinating Mar 26 '14 at 15:53

I would say if the answer, really answers the question, and follows a different approach, you should not delete it. Even though it might not be the best solution around, it certainly gives a user to see various possible answers. And the best answer will anyways be at the top, when it is accepted.


Does your answer add value? Is someone who comes along and finds this question, when they have a similar problem, going to be better off reading both your answer and the other answer, or would they be better off just reading the other answer?

If it's not quite as good, but it still adds value, keep it around. If it honestly adds no value, or worse, if it adds negative value, then delete it. Keep in mind that there are a lot of ways for an answer to add negative value. Reading answers takes time; if you think that the answer is worse than others, and everyone who reads it will think, "well I can't get those 2 minutes of my life back," even if the answer works, it's still not adding value. On the other hand, if it contains some information that you think others would find useful, that isn't found in other answers, or if there is a small handful of people that your answer would help that another answer wouldn't (a common example of this would be if your answer works on an older version of a product) then that could be how it adds value.


Deleting your own answer and your voting behavior is always entirely up to you (whether others think it is correct or not). I normally would leave it and especially in this case. It looks like your answer is different and whether it is inferior or not, I can't say since I don't know anything about RoR. However, some things work better for some while other techniques might work better for someone else.

Unless you find/realize that your answer is wrong I don't see any reason to delete it.

Your answer does seem to add a bit since it uses a ternary operator which someone may stumble upon who didn't previously know about that type of operator. You also may want to take into account comments on the answer knowing that they will be deleted also (may or may not make a difference in this scenario).


Try to improve your answer

See if you can explain it further or offer additional solutions. Good explanations can be even more help than the fixed code. See the comments on your answer and the others to get tips for improvement.

Delete only if there's no value from it

If your answer is exactly the same, except for a few commas or variable names, it might be better to delete it, but it's not required. If you just happened to post it at the same time, it's okay to keep it.

But at the end of the day, it's up to your own decision.

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