Telling the user the number of days it's been since January 1st

So far, this question has:

  • 4 total close votes
  • 3 have decided to Close (from the queue)
  • 3 have decided to Leave Open (from the queue)

One user has indicated that this question is off-topic because it looks like it violates rule #4 of allowed topics. The OP has stated that he can only use if-statements. No specific reasons for that are given, but I assume it's school related. Either way, there's some dispute here, and we need to resolve otherwise that post will become locked until a decision is made on Meta.

So, should this question be closed, or not? We can all decide on that, or the last person (possibly me) could put in the last vote. Again, we need to decide because such disputes can end in a lock.

  • 1
    \$\begingroup\$ As the question stands now, I don't see anything about if statements at all. But (without actually looking at the code) it also looks like “asking code to be written” question to me. \$\endgroup\$
    – svick
    Nov 16, 2013 at 21:15
  • \$\begingroup\$ @svick: Well, you do need to look at the code to see all the ifs (and there are a lot). The OP has also used the word "redo," which could imply refactoring. Anyhow, I've already flagged a moderator, just in case the community cannot decide on something. \$\endgroup\$
    – Jamal
    Nov 16, 2013 at 21:19
  • \$\begingroup\$ The way I see it, it's like asking for a review of, say, a calculator's code that can only use the + operator. Hence, I find it's against the spirit of rule #4. \$\endgroup\$ Nov 16, 2013 at 21:55
  • \$\begingroup\$ @retailcoder: Yes, but does that really make it bad code? Yes, the calculator will be bad, but the code can still look like a million bucks (or rep points). Remember, this is closely related to the code's format. If it's not meant to be the shortest or most confusing code, then it doesn't quite fit that rule. \$\endgroup\$
    – Jamal
    Nov 16, 2013 at 21:58
  • \$\begingroup\$ As I said I'm not taking the rule literally - I know this isn't code-golf, but there are much cleaner ways to solve what the OP is trying to solve if you lift the "only ifs" game. I see the spirit of that rule as the question is on-topic if the code has constraints that can prevent a review from suggesting better approaches - in this case the "only ifs" rule is one such constraint. \$\endgroup\$ Nov 16, 2013 at 22:10
  • \$\begingroup\$ Wow what a lapsus.. I meant the question is off-topic if... now given the last couple answers on that specific question, I'm willing to retract my close vote on that one, so we can reach consensus. But this is still a good discussion about the said rule #4 :) \$\endgroup\$ Nov 16, 2013 at 22:18

1 Answer 1


I say leave it open, it can still be good code with if statements, right?

can we put a restriction on our code saying that we want to use a while loop and not a do while, isn't this kind of the same thing?

I don't code in the given language, but I am not seeing why the OP can't say they want to do this with if statements?

maybe there is more going on with this than I am seeing.

  • 1
    \$\begingroup\$ I have retracted my close vote. \$\endgroup\$ Nov 17, 2013 at 18:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .