Questions are mostly down-voted when they do not show sufficient research.
Situation 1: If you have gone through the documentation and are unable to understand, there is a chance that someone else has already raised that issue on SO. There are also many blogs and tutorials to help you get started, especially for popular languages. Refer to them. If all else fails, link the documentation (or other tutorials) to your question, and mention the exact lines that you are having trouble comprehending.
Situation 2: You are always expected to try to solve yourself and search SO before asking. If you're a beginner in a particular language, there is a very high chance that a similar question already exists. If you find a similar but slightly different question, include a link to that question and explain how yours is different.
Always include the code that you've already tried. Although SO may seem unwelcoming to new users, in my experience, if you show adequate research, you will most likely get a good answer.
Edit: Just to make things clear, your each question should be self-contained. Nobody would like to click a link and read your previous question to understand the background. Include all necessary information and code with each question. What I meant with include a link to that question and explain how yours is different
was that you have to make people understand that you have already tried A, B and C as mentioned in this similar question, but none of them seem to solve your problem.