No, code should not be added with an edit: When should I make edits to code?
Author of the other answer correctly did not add code to your answer - adding new code to existing answers is essentially prohibited for edits that require review and frowned upon for all other edits. The only real option they had is to post new answer that includes the sample. Fortunately they also had something else to say on the topic so they got real answer where second alternative based on your question was mentioned.
Your options:
- be happy and do nothing (because you really did not think sample was of any use before that second post anyway)
- write your own sample without looking at code in the second answer
- refer to the second answer for the sample.
- copy the sample with detailed attribution (this is very questionable approach as basically you can't have summary of the link and had to paste whole code, plus it will look like reputation grab)