# Changed question code - what to do?

As seen in This meta post, questions aren't supposed to change their code beyond copy/paste errors or minor syntax problems which aren't the subject of Code Review anyway.

It did happen here. How should I respond? I cannot find an appropriate flag for this. "Request for Moderator Intervention" feels like throwing a nuke at a cockroach - there is no objectionable content in itself.

Simple rollback may also not be appropriate. I suspect that the current code is the "real" code and the original was only a fragment. While this of course means that the current code should have originally been posted, it does now almost completely invalidate my answer.

So in short:

• I would say that it depends on whether the original question is on-topic or not. If it is (i.e. sufficient context, working code, ...) then your answer is valid as well, and the code must not be updated. – If the question is off-topic for some reason, then any answer is invalid and the question should be fixed. – Martin R Oct 29 '19 at 10:31
• It was on-topic, and valid code aside from not returning an obvious return value, which I think is minor enough to let slide. However, the current, more complete code is straight up a better question. (Basically, the code calling the original function is included.) – Gloweye Oct 29 '19 at 10:35

## 1 Answer

It somewhat pains me to do this, but as it stands, the question needs to be rolled back. So that's also what I did.

As MartinR observed in the comments to your inquiry here, answers to off-topic questions do not trigger answer-invalidation concerns. But since the question was on-topic when you answered it, this is a case of invalidation and needs to be handled like it.

If OP still wants a review on their full code, a new question is the correct way to go :)

• I'm OP of the question - indeed only after I submitted the question is that some comments pointed that my code was not "complete and working" - I missed that part, sorry, kind of new here and used to stackoverflow, where fragments are way to go. Anyway, flagging and closing the question as off-topic would be the right thing to do imo. – Raf Oct 29 '19 at 12:26
• @Raf I don't quite understand why you'd want your question to be considered off-topic when it's not... It's common for code review questions to omit surrounding code that's not subject of the review. That alone does not make a question off-topic. – Vogel612 Oct 29 '19 at 12:33
• ok, that makes sense to me, and indeed posting the complete code just added a lot of overhead and hides the purpose of the question. But from my understading the code is required to be "complete and working", and code fragments are neither. Also, some comments pointed me in that direction. I guess definitely guidelines need to be more clear. – Raf Oct 29 '19 at 12:39
• @Raf You don't need a full blown program for a meaningful review. Even though it would make for a better question. Single functions are often up for review as long as there is enough context to understand what's not in the code (documentation of API used, link to a repo with the definition of the remaining functions, example of calling code...). In "complete and working", what should be complete is our ability to understand the code (we shouldn't have to guess anything) and the code must be working in the grand scheme of your environment. – 301_Moved_Permanently Nov 8 '19 at 8:11