On a question I was about to add an answer but someone else had already said basically what I was going to say, so I just added my code example to their post. Is that kosher or should I have added my own answer?
I wouldn't edit to add code. I would edit to fix a simple grammatical mistake or correct some formatting, but never to enhance the answer. It could be taken wrong by the person answering. Your best bet is to create another answer plus it could give you potentially more reputation points. :)