Only debugging style questions explicitly require code.
I would like to take this chance to correct a common misconception.
If a user has code that doesn't work, and they are asking us why their code doesn't work and how to fix it, they must include a Minimal, Complete, and Verifiable example for their question to be on-topic.
Non-debugging style questions are less likely to be too broad or unclear if they do include a code sample (even pseudo code) that demonstrates their intent; but not including a code sample doesn't make the question off-topic by itself.
If you're closing questions solely because they don't contain code, you're doing it wrong
Everyone likes numbers, right?
These numbers were current when I wrote this answer. These statistics do not include deleted questions, but the point of this is not to say that questions which don't contain code are all inherently good questions, but rather that questions which don't contain code are not all inherently bad.
There are currently 12,882,683 questions on Stack Overflow, of which
Based on this we can see that a sizeable portion of questions do not contain code, most of which are not closed, and a reasonable amount of them are well received.
Take a look at the first link above and you'll find that a large number of these codeless questions have proven to be extremely useful.
You are asking the wrong question.
What's better: a question with no attempt or with an unfixable/irrelevant attempt?
As "better" is ambiguous, I'm going to replace it with "more useful", which is what I think you mean.
Questions can have varying degrees of usefulness regardless of whether or not they contain code. That said, quality, usefulness, and research effort have no pertinence to close voting; that is what up and down votes are for.
- If a question shows a lack of research effort, is unclear or not useful, it should be downvoted.
- If a question shows research effort, is clear and useful, it should be upvoted.
Is the question on-topic and answerable in its current state?
This is the question you should be asking yourself whenever you're contemplating the closure of a question, regardless of whether or not the question contains code.
- If the answer is no and there is an applicable close reason, vote to close it!
- If the answer is yes, answer it! 1
- If you can improve the relevance or usefulness of a post without changing the meaning, edit it! 2
If the question is a programming question, on-topic, and not answerable in its current state, but does not fit the criteria for any of the existing close reasons, don't worry about it.
The whole point of closure is to prevent questions from receiving answers. So if the question is truly unanswerable, it isn't going to be receiving answers, and we don't need to spend any of the limited number of close votes we have in a day on them.
The roomba will clean them up eventually, and there is a seemingly endless supply3 of questions that are much more worthy of your precious few close votes.
If you need to bend a close reason to fit the question in order to justify closure, the closure isn't really justified.
Who knows? At some point in the future it might actually be answerable, or someone else may see something that you don't. If it does receive a useful answer, even better! Not closing it means that you didn't prevent it from receiving that answer.
You saved the day by doing nothing at all, and you had one more precious close vote to spend that day. It's a win-win!
1: If the question is a duplicate, you should not answer the question, and instead vote to close it as a duplicate.
2: If you are going to edit, make sure your edits are substantive
3: The Close Vote Queue is big. Really big. You just won't believe how vastly, hugely, mind-bogglingly big it is. I mean, you may think it's a long way down the road to the end of any other queue, but that's just peanuts to The Close Vote Queue.4
4: Paraphrasing a quote from Douglas Adam's The Hitchhiker's Guide To The Galaxy