How to post program code in the forum.

Program code is unique, in that indentation and spacing are often important, especially with Spin, and it always looks better when rendered in a monospaced font. Fortunately, posting code so that it looks right and can easily be read by others is very easy. For example, here's some Spin/PASM code that was just pasted into the message edit box:

See how much easier it is to read and how nicely everything lines up? It's not hard to make this happen. When creating or editing your post, just enclose your code between [noparse]

[/noparse][/b] and [b][noparse]

[/noparse] tags, like this:

IMPORTANT NOTE: Do not use the WYSIWYG Editor when entering or editing posts with code. Use the Basic Editor instead. The WYSIWYG Editor messes with numeric data following a percent (%) sign and enters the code incorrectly.

Impossible is just a big word thrown around by small men who find it easier to live in the world theyve been given than to explore the power they have to change it. Impossible is not a fact. Its an opinion. Impossible is not a declaration. Its a dare. Impossible is potential. Impossible is temporary. Impossible is nothing. Muhammad Ali

Comments

If you see a forumista who needs help posting code, copy and paste the following as a reply to his post:

[noparse][/noparse]

What will get displayed is this:

-Phil

Impossible is just a big word thrown around by small men who find it easier to live in the world theyve been given than to explore the power they have to change it. Impossible is not a fact. Its an opinion. Impossible is not a declaration. Its a dare. Impossible is potential. Impossible is temporary. Impossible is nothing. Muhammad Ali

Impossible is just a big word thrown around by small men who find it easier to live in the world theyve been given than to explore the power they have to change it. Impossible is not a fact. Its an opinion. Impossible is not a declaration. Its a dare. Impossible is potential. Impossible is temporary. Impossible is nothing. Muhammad Ali

Impossible is just a big word thrown around by small men who find it easier to live in the world theyve been given than to explore the power they have to change it. Impossible is not a fact. Its an opinion. Impossible is not a declaration. Its a dare. Impossible is potential. Impossible is temporary. Impossible is nothing. Muhammad Ali

...couldn't Phil have done that, being a Moderator, or does that take a Staff or Admin to do that?

I'm sure it's restricted to Admins, as it should be. Even if I could have, though, stickifying one's own thread unilaterally would be considered bad form. BTW, I'm not a Moderator. Browser (my cat) has the mod status in this household -- and not just in the forum. :)

-Phil

Impossible is just a big word thrown around by small men who find it easier to live in the world theyve been given than to explore the power they have to change it. Impossible is not a fact. Its an opinion. Impossible is not a declaration. Its a dare. Impossible is potential. Impossible is temporary. Impossible is nothing. Muhammad Ali

I'm sure it's restricted to Admins, as it should be. Even if I could have, though, stickifying one's own thread unilaterally would be considered bad form. BTW, I'm not a Moderator. Browser (my cat) has the mod status in this household -- and not just in the forum. :)

You want to use code tags. The brackets are part of the tags. Don't replace the word "code" with your program. The word "code" is part of the tag. Here's what you'd enter: (I used a zero instead of an "o" so the word "code" will show up here.)

I don't know if it was intentional, but, when you use simple code tags for C++ or C code it just shows in one color, but when you put it between PHP tags even though it is not php code it displays multi color coded which IMO easier to read.

Impossible is just a big word thrown around by small men who find it easier to live in the world theyve been given than to explore the power they have to change it. Impossible is not a fact. Its an opinion. Impossible is not a declaration. Its a dare. Impossible is potential. Impossible is temporary. Impossible is nothing. Muhammad Ali

It is always very helpful to indent code for readability whether the language requires it or not.

That's what I kept telling my students. They finally paid attention when I told them I wouldn't help them with compile errors unless their programs were indented neatly. :)

-Phil

Impossible is just a big word thrown around by small men who find it easier to live in the world theyve been given than to explore the power they have to change it. Impossible is not a fact. Its an opinion. Impossible is not a declaration. Its a dare. Impossible is potential. Impossible is temporary. Impossible is nothing. Muhammad Ali

The reply was for those of us trying to help you with the code tags and how to use them. You followed the instructions in the second post, which weren't about your issue. Please read post #1 in this thread and the edit your post in your original thread with the code tags to post your code. Optionally you can attach it.