2

I recently asked the hypothetical question of "How can you create a while loop using only if statements?" which seems to be specific enough for a title. I did make the mistake of not providing enough context, so I edited the answer and added it. Luckily, got an answer that solved the problem I was facing. However, that is not the issue nor the reason why I am asking this question. One well-respected user claimed that my question was a homework question when it was not and suggested I read the How do I ask a question.

  1. I looked for the question and I did not find it. I did some research and I did not find the specific answer I needed.

  2. I am pretty sure the title was descriptive enough.

  3. I introduced the problem (after the edit).

Now, I think that is good enough for a question on SO. So what do I have to do when the situation mentioned in the title arrives?

I really don't think I handled that well and given that the user who said it has been on SO longer than I have, I think it is pretty safe to assume that it was all my mistake. So, what do I do when this happens and can I improve the quality of my questions to avoid it in the future?

Here is the question.

19
  • 4
    "I did some research and I did not find the specific answer I needed." How are we supposed to know that? Why didn't you give any indication of this research in your question? No one cares if the question is homework or not. What people do care about is you putting some effort into it, before you turn to Stack Overflow for help.
    – yannis
    Commented Aug 31, 2017 at 1:47
  • @yannis You are right... I did forget to do that. So that is what caused this whole situation?
    – user8157871
    Commented Aug 31, 2017 at 1:51
  • @yannis I just saw your edit. Yes, that is why. I am definetely going to show that I am putting some effort next time.
    – user8157871
    Commented Aug 31, 2017 at 1:57
  • Lol. I feel for you man. The problem with volunteers is that you can't fire them. All you can do is hope you don't cross paths with them.
    – user2066936
    Commented Aug 31, 2017 at 2:25
  • Note that accepted answer to your main question does not actually answer the question as it is asked now. If your goal is to confuse future potential visitors that have the same question it is perfectly fine (as acceptance only means "helped the most"), otherwise you may want to actually make sure answer actually answer what is asked in the post and not what you are interested to know. Commented Aug 31, 2017 at 2:44
  • @AlexeiLevenkov that answer actually helped me a bit. I am writing a prototype in Python right now. Should I post it as an answer when I finish it so that future visitors have an actual code instead of pseudo-code?
    – user8157871
    Commented Aug 31, 2017 at 2:50
  • Because what you want to do is a classic homework question, and there's no practical reason to ever do things that way other than as a homework assignment. There's no problem with asking for help on your hoemwork when you've done some leg work yourself first, but if you ask an obvious homework question without showing some effort I'm downvoting and voting to close instantly. Commented Aug 31, 2017 at 2:51
  • @GabeSechan I think I already discussed that point quite a bit. I'll just post the small prototype in a few minutes. By the way, recursion was the answer.
    – user8157871
    Commented Aug 31, 2017 at 2:54
  • 2
    @ArmandoH. Wrong answer. The correct answer is goto, which is how it works on an assembly level while(cond) {do_loop} is translated to loop: if(cond) { do_loop; goto loop} Commented Aug 31, 2017 at 2:55
  • 1
    @GabeSechan I'll iterate comments from post here: neither recursion nor jumps are allowed according to question as asked. So there is no way to implement while with constraints in the question. The fact that "use recursion" helped Armando and they accepted the answer does not mean that it is possible to implement iteration without jumps and recursion. Commented Aug 31, 2017 at 3:06
  • @AlexeiLevenkov Then fix the language. Its broken. Anything relying on recursion for iteration is horribly inefficient. And take it to cs.stackexchange.com which is where questions like this belong. Commented Aug 31, 2017 at 3:08
  • I never said recursion was not allowed. In fact, I did not know it was used and that is why I did not mention it.
    – user8157871
    Commented Aug 31, 2017 at 3:12
  • It was just a horrible question. It was supposed to be a challenge using only definition of variables, functions and if statements. Recursion worked under those circumstances.
    – user8157871
    Commented Aug 31, 2017 at 3:15
  • @ArmandoH. The way main question is phrased currently excludes recursion. This is perfectly valid assignment for beginning of "compilers 101" course. You'd expected to find that you need more than just functions and conditional statements (recursive functions are much harder to implement than non-recursive once as you can't make all variables global hence will likely show up later in the course). Post still looks like homework assignment with no effort to solve anything (and edit in "answer" does not show research effort). Commented Aug 31, 2017 at 3:26
  • Maybe the user is mistaken that this is homework but what is the point of this thread? You asked a question without writing any code yourself. Did you expect users to write all of the variations of how it can be done for you? These types of questions will always get downvoted and closed.
    – tima
    Commented Aug 31, 2017 at 4:25

2 Answers 2

1

The main mistake you made, was not offering some information around it. Your reasoning about why you want this, helps to show the community that you understand the basic concepts you are referring to.

Next time add more information. If people start pouring on comments, bring it here, as you did. Hopefully we can bridge the gaps in communication.

Also - to note - some people in the community react to a lack of code. This is unfortunate, as there's many good questions that can be asked without code or with minimal code.
For example:
How to undo the last commits in Git?
What is the difference between 'git pull' and 'git fetch'?
What and where are the stack and heap?

I edited your question for clarity. If you try to keep it neat and ordered, it will help.

5
  • What redeeming value do you actually see in that question?
    – Makoto
    Commented Aug 31, 2017 at 2:08
  • @Makoto in the one asked on SO by the OP? I think it's challenging and fascinating.
    – user3956566
    Commented Aug 31, 2017 at 2:16
  • ...Does that make the question on-topic though? I've seen lots of challenging and fascinating questions here, but that never implied for an instant that they were on-topic.
    – Makoto
    Commented Aug 31, 2017 at 2:35
  • @Makoto I hear you - yes I think it's answerable within the context of our site.
    – user3956566
    Commented Aug 31, 2017 at 2:36
  • Its not a very terrible question, it makes you think. Not very useful to others though.
    – Gimby
    Commented Aug 31, 2017 at 11:20
4

The policy on homework is universal: it doesn't matter if it's a homework question or not. It has to be on-topic and suitable for the site.

From the looks of the comments, one of the commentators seems to be arguing more towards...the latter part of that requirement. They're not seeing how this question is suitable for the site.

Interestingly enough, I don't disagree. As an engineer, we think of if and while in different contexts. Sure, it might be possible to create a loop through ifs, but how useful is that knowledge, really? How beneficial is it to know if this can be done? Who would even bother with such a thing when recursion is a more conventional and familiar non-loop looping construct, anyway?

My recommendation to you in the future would be to stick to questions which are on-topic. Namely...look to questions that are actually answerable and unique in the context of software development. Perhaps if you had introduced a constraint in which your application could only loop with ifs, then perhaps we could've had a discussion about recursion. As written though, I'm not a fan of it.

1
  • Recurssion is allowed. I mentioned that the language has the ability to define funcitons.
    – user8157871
    Commented Aug 31, 2017 at 2:56

You must log in to answer this question.