What are the rules for code snippets?

Not an author yet? Have questions? Post here!

Moderators: Celeste Stewart, Ed, Constant

Locked
Lysis
Posts: 1529
Joined: Sun Jun 07, 2009 2:08 pm
Contact:

What are the rules for code snippets?

Post by Lysis »

I've written articles with a one-line code snippet, but is it acceptable to put a large code snippet? I think a code snippet would enhance the article, but I'm not sure if it's allowed.

For example, I'm writing about an XML file format, and I wanted to give an example. So, I wanted to do something like:

An example of a sitemap file format is below:

<urlset>
<url>
<loc>url</loc>
<lastmod>2009-12-20</lastmod>
<changefreq>monthly</changefreq>
</url>
</urlset>


Is this ok? Also, in the programming world, tabs are a standard to format the code. So, basically the above should read:

<urlset>
<url>
<loc>url</loc>
<lastmod>2009-12-20</lastmod>
<changefreq>monthly</changefreq>
</url>
</urlset>

If a code snippet is allowed, is the above allowed?

**Edit...bah, the forum software is trimming my spaces!
Ed
Posts: 4686
Joined: Mon Feb 20, 2006 2:15 pm

Re: What are the rules for code snippets?

Post by Ed »

Yes.
Lysis
Posts: 1529
Joined: Sun Jun 07, 2009 2:08 pm
Contact:

Re: What are the rules for code snippets?

Post by Lysis »

Sweet!

And that was quick!
Locked