It is interesting just how many people don't read threads on forums before they decide to add their post to it. The number of threads that have the same nonsense repeated multiple times just makes the later posters look even stupider than the one that posted the nonsense the first time. Now this doesn't mean that they are not entitled to believe that what they are saying is not nonsense but they almost never post any sort of argument for their view at all and never provide a counter argument to the one that proposes that it is nonsense. They simply post without having read what came before.
One important thing to do if you are trying to contribute meaningfully to a forum is to not only be able to provide a quick answer but also to be able to explain why your answer is right. If you can't explain why your answer is right then how do you know that it is? If someone posts a counter argument and includes an explanation of why they think you are wrong then you need to either abandon your view or you need to post a counter argument as to why that persons view is wrong.
In most cases the answers are not black and white. Your answer may be right to an extent where what they are pointing out is that there are lots of other better alternative answers. You may disagree with them as to why they believe their answer is better but you need to be prepared to explain why you think your answer is better than theirs. When there is a discussion of the pros and cons of the different possible answers then the person asking the question is far more likely to be able to choose the more appropriate answer that suits them. If there are several people who just post the same thing without explanation where someone else has already posted an alternative answer and provided an explanation of why they think it is better then the person who asked the question then has to choose between one answer that has an explanation of why it is the better alternative and the alternative which only has popularity going for it.
It is not just the answer posts that can be pointless and make the poster look stupid though. The person posting the original question can look just as stupid if they don't ask their question properly (of course allowances need to be made for people who are writing the question in what is to them a foreign language).
When asking a question on a forum you need to be as specific as possible. The more general the question the less likely you are to get answers and the more likely that the answers you do get will not be helpful. When asking a question that involves writing code the most essential thing to include in your post is what code you have already written that is supposed to be the solution to your problem but which isn't currently working. That way the answers will relate to what you already know.
If the question is homework for a course you are doing then make it clear that it is homework (and if it isn't then make that clear too if it looks like it could be). That way the answers you get will be more appropriate. The best answer for a homework problem is often completely different from the best answer to a real world problem as a homework answer is dependent on what you have already been taught in the course whereas a non-homework answer can use any aspect of the language including those you don't yet know. In some cases the version of a language being taught in a class is an outdated version that shouldn't even be used any longer in the real world (often course curriculum only changes every so many years and the language it is teaching changes significantly several times before a replacement course is provided). This can mean that there are numerous alternative ways to answer the question depending on the particular version of the language that the course is using as well as on what part of that version has been taught. This means that providing what you already have as code is even more important as it gives those trying to help a starting point in figuring out which version of the language you are being taught so that they can help you to get a working answer that you can explain in terms of what you have been taught. Where you are being taught an old version you may also be provided with code that shows you how it would be written in the real world today so that you can see how much extra you will need to learn after the course.
Where someone asks a coding question without providing code and without stating that it is homework and I happen to have code available that answers the question then I might decide to share that code as an answer to their question. Of course if it is a homework question then they will almost certainly not understand my answer and my answer will be very obviously not something that they could have written for themselves so that they can't use it as the answer to their homework.
Whether you are asking a question on a forum or writing a response to the question, you should try to be specific. Provide all relevant details so that anyone reading can understand why you have said what you have. Remember also that it is not just the person who originally asked the question who will read your answer. Others with the same question can find the thread via a search and their reasons for wanting an answer may differ from that of the person who originally posted the question. The original poster (often abbreviated OP in responses) may be asking for help with homework while the person who found it through search may be looking for a way to implement it in the real world. Adding a real world solution to a homework thread will not only show the person trying to do their homework the difference between what they have been taught so far and what a real world solution looks like, it will also ensure that anyone asking the question is going to be more likely to find an answer appropriate to their circumstances.