As already mentioned, pseudocode can be written in many ways. Often pseudocode is used by
experienced programmers (at least those that I know) to express individual
algorithms or
ideas that will be used in a
variety of
languages. An example would be the traditional
bubble sort (or
sink sort as it should be called), which is a
decent way of
sorting items and will work in
virtually all
languages.
When a programmer designs their own algorithm, they may tend to remember it in pseudocode, especially if it was designed arbitrarily in their head, as opposed to on a computer. An example might be the pseudocode for a prime number finder:
begin function isprime(number)
make counter var as longint
make factorcount var as shortint
begin loop from 1 to number
check if modulus of number by counter is 0
if so, add one to factor count
end loop
check if factor count is greater than 2
if so, return false
else return true
end function
The above is, of course, somewhat
verbose. It could be
abbreviated, which will often lead to it just being written in
code. The above is extremely simple in
C++ or
Pascal and is not necessarily a good
candidate for
pseudocode description.