Hide
Siafoo – the intersection of pastebin, help desk, version control, and social networking Join Siafoo Now or Learn More

Writing Pseudocode Atom Feed 0

In Brief: Pseudocode writing guidelines

1   What is pseudocode?

As the name implies pseudocode is not quite code, meaning it is a mix of your choice of programming language and your preferred human language. Traditionally pseudocode resembles something like C or Pascal but it can be anything you choose.

2   Writing pseudocode

When writing pseudocode try to focus on presenting the algorithm, clearly. Try to use operators and keywords that are simple to understand. Avoid using if/end if or bracket pairs to denote blocks of code, as it forces the reader to parse more elements in order to understand the operation of the algorithm.

We encourage you to look through some of the Algorithms on Siafoo and try to maintain a similar pseudocode style.

3   Pseudocode support in Siafoo

The Siafoo pseudocode lexer is intended to make the job of presenting pseudocode easier. It will highlight string literals enclosed in both single (') and double (") quotes, as well as integer, floating point and scientific notation numbers. It also supports single line C++ style comments //.

3.1   Recognized Operators

Operator Usual Purpose
+ Addition
- Subtraction
/ Division
* Multiplication
** x to y Power
^ x to y Power
% Modulo
*= Multiply and assign
+= Add and assign
-= Subtract and assign
/= Divide and assign
++ Increment
-- Decrement
= Assignment
:= Assignment
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
== Equal To
-> Replaced by , denotes 'To'
<- Replaced by

3.2   Builtins

To prevent our pseudocode lexer from making a complete mess of your pseudocode, no builtin keywords or functions are provided. However you can enclose any word with backticks ( ` ) and it will be rendered as a keyword and treated like a language keyword. Good uses for this would be, things like for, if, foreach, etc.