Only debugging style questions explicitly require code.
This is a common misconception that I would like to take this chance to address.
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 may be too broad or unclear if they require code to be answerable but do not include it, but they are not inherently off-topic solely because they don't contain code.
If you're closing questions solely because they don't contain code, you're doing it wrong
Everyone likes statistics 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 that 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 by "better".
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 a question, regardless of whether or not that 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, not answerable in its current state, but does not fit the criteria for any of the existing close reasons, don't worry.
Because it is unanswerable, it will not be answered, will be deleted by the roomba, and does not need to be closed.
The whole point of closure is to prevent questions from receiving answers. If the question isn't going to be receiving answers, why do we need to waste our limited number of votes closing it?
There are many more closure worthy questions for you to spend your close votes on, and there is no need to bend a close reason to fit the question at hand.
If it does receive a useful answer, even better! This means that it was answerable, and you didn't prevent it from receiving that answer.
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