Could someone please clarify why on earth is this edit rejected because:
This edit is incorrect or an attempt to reply to or comment on the existing post.
Meta Stack Exchange is a question and answer site for meta-discussion of the Stack Exchange family of Q&A websites. It only takes a minute to sign up.Sign up to join this community
I'm sorry your edit was rejected. It was perfectly correct. The original poster even made the same change a few hours later (he was notified of your edit, but too late to do anything about it).
It is generally a bad idea to edit code in questions on Stack Overflow, because you might inadvertently fix the problem code that the asker was facing. This reasoning only applies to questions, not answers.
The official guidance on editing states (excerpted):
When should I edit posts?
Any time you feel you can make the post better, and are inclined to do so. Editing is encouraged!
Some common reasons to edit are: (…)
- to correct minor mistakes or add addendums / updates as the post ages
Correcting a typo in code absolutely fits the bill.
Unfortunately there are a few users who frequent Meta Stack Overflow and saw a guideline not to edit code in questions, but stopped reading in the middle. Don't let them stop your good work.
If you have asked about the rejection of this edit suggestion then here is the reason:
You tried to change the original post by replacing a variable with another variable, which is highly discouraged by the Stack Overflow community. Best approach is to add a comment mentioning that the code has issues and what is the correct code. Let the original poster see your comment and then he/she may decide to edit the post himself/herself.
Editing should be done to improve the post like formatting, correction of language, etc. Editing should not be include any changes which modifies the content of the original post.