Imagine that the question is simple enough to answer with one sentence (or one line of code) and it's not really useful for the community - only for the OP asking.
What should I do? Leave a comment, or make it an answer?
Imagine that the question is simple enough to answer with one sentence (or one line of code) and it's not really useful for the community - only for the OP asking.
What should I do? Leave a comment, or make it an answer?
Such questions ought to be closed. Do not answer a question that you think deserves a closing.
It is really a bad idea to post one-line-of-code answers (though everyone does it). These answers aren't really helpful to anyone but the OP. If you can, it ought to be expanded with an explanation. If you can't explain it (or the explanation is too "dry"), the question is probably close worthy (/flag worthy). Use "too localised"
Actually, the above points also apply to any type of code-only answers, just to a much lesser extent.
If you want to help the OP anyway, you can always answer in a comment.
We want our answers to be of use to visitors, not just the OP. More often than not, code-only answers just solve the OPs problem. They don't help anyone learn anything, and don't help visitors at all. We don't want to be one of those fora where you post any damn thing and get a solution--that's just clutter. We want to Make The Internet Better(tm) with good answers that explain the issue, and help everyone learn--the visitors and the OP alike.
I'm not sure there is a hard rule for this, but my suggestions is that even if stopping at one sentence is enough, try to expand it. If the question is not a great question, your long and explicative answer will improve the question "overall" and it'll probably give you lots of upvotes.
As hinted in the comments under my answer, this is actually encouraged behavior. If you gain +20 upvotes and the question is at -5, you'll get the Reversal badge. Don't stop at the minimum: if you think you can say more (related stuff), then do it!
By the way, if the question deserves to be closed for some reason, go ahead and vote to close.