Pseudocode and You — Writing in Plain Speech
When programming, one of the most beneficial practices to commit to habit early is writing out Pseudocode.
Pseudocode is just plain written language that details what your code does, or is supposed to do.
In a previous article, I demonstrated how to set up 2D player movement.
Here’s what pseudocode would look like for that:
Let’s look a a theoretical example with a little more complexity.
Pseudocode can be used to tell us the goal of the code.
In this example, the goal is to have the player’s speed value be changed when we press the spacebar.
Let’s start with the pseudocode, what do we want to do?
This is a start, but we can make it clearer and easier for someone else (or ourselves coming back to this code later).
This is an easy implementation using an If statement.
I will cover If statements in detail in a later article, but they are extremely common and useful, especially for input commands!
A final note on Pseudocode; It is even more paramount when working in a group! Leave easy to follow pseudocode so your team can all be on the same page, even when you cannot sit down and explain it verbally!