I downvoted because

without code, it is very hard to help you

It’s hard to answer a programming question without code

It’s really hard to answer a question about a bug in code when the question doesn’t include any of the buggy code. In order to help fix the problem, answerers are going to have to see what the code is.

Why this is a problem

The question is about an issue in code. Perhaps it wasn’t giving the expected outcome, or was not compiling, or maybe when running it threw an exception. Unfortunately, it is not possible to answer the question unless the relevant code is available. People trying to help need it to examine in order to find the source of the error.

Why this is worth a downvote

Without the code, the question is not answerable. Any solution would be based on guesses. Even if someone guessed right, not having any code means it’s harder to relate for future readers. Questions that aren’t useful for people other than the asker are discouraged on Stack Overflow.

It can also show that not much effort was put into writing the question. Remember, people with lots of experience are volunteering their time, for free, to help. Giving these people enough information to answer questions is the most important thing anyone asking for help can do. Failing to do so wastes people’s time, which is seen as rude, which can attract downvotes. It also makes it less likely to attract answers.

What to do next

Edit the post to add a Minimal, Complete, Verifiable Example (see the Stack Overflow help center for details on how to do this).

The code should not be directly copy/pasted in its original form. Instead, it should be cut down to only keep the parts essential to identify and reproduce the issue. This reduced and isolated code should be tested to verify it exhibits the same issues as the original. This is commonly referred to as an MCVE. Once code is reduced to the minimal amount that still exhibits the problem, it should be edited into the question.

With well-formatted minimal code, problems can be quickly identified by experienced users. They will be able to quickly add answers to the question with valid solutions. These answers will be of higher quality and relate better to the issue posted, drawing more attention to the question (and more upvotes). Future readers will be able to quickly identify if the root cause of the issue relates to them.

Please don’t use comments to add code to a question. Comments cannot be properly formatted, and are not considered a valid place for code. There is an “edit” link below all questions and answers that can be used by any user to edit and improve the post.

Everyone should take the time to format code in posts correctly. Messy code makes it harder for others to understand what the code is doing. Help with formatting code can be found here.

Leave a comment!

Once you have done this, leave a comment to the person who sent you this link. They will be happy to retract their downvote.

Did this page help you?

This website is here for everyone’s benefit, most importantly yours! If this did not help you, or if you would like to leave feedback, please create an Issue regarding this page on GitHub, or submit an improvement directly.