The pseudocode is not a specific language. It is rather pattern of design of some part of code avoiding its syntax when you
- Don't know the language
- Have a better things to do than care about syntax
The example can be - if you want to tell someone how to make a method to check how many array elements are odd you can write
for every element in the array:
if is odd:
increase odd_counter
else
do nothing
print odd_counter
it is not any language it is just "how to write it less or more"
Just to make it more visible - please look at tcooc's comment below - the valid code in Java/C++/etc can also be kind of pseudocode
Answer from m.antkowicz on Stack OverflowI'm running late on an assignment and don't know how to write pseudo code, is there anywhere that could help me out?
The pseudocode is not a specific language. It is rather pattern of design of some part of code avoiding its syntax when you
- Don't know the language
- Have a better things to do than care about syntax
The example can be - if you want to tell someone how to make a method to check how many array elements are odd you can write
for every element in the array:
if is odd:
increase odd_counter
else
do nothing
print odd_counter
it is not any language it is just "how to write it less or more"
Just to make it more visible - please look at tcooc's comment below - the valid code in Java/C++/etc can also be kind of pseudocode
Pseudocode varies from person to person, since it's basically just sentences/phrases formatted to look like code.
For example, I would write your example in pseudo code this way:
hour = parseInteger(hourString);
minute = parseInteger(minuteString);
if (errors)
output("error message");
That's just me though, I prefer my pseudocode to look more code-like. Someone else might write the exact same example like so:
Try to
Parse hour integer,
Parse minute integer
If there were errors,
Write the errors to console.
It's totally dependent on the person writing it.