This page is a brief overview of the policies towards example code—including format, content, and copyright issues—on the English-language edition of Wikipedia.
Example code should be used to aid the understanding of a concept in an article. Particularly, it is useful to illustrate the implementation of specific algorithms and the use of specific programming languages.
Example code should not be used to introduce new concepts, as this may confuse the reader. Only use it in instances where it improves the understanding of the existing concepts.
Here are a few examples of articles that use source code to elaborate on concepts: