Pseudocode isn't real code, it's human language written with a similar specificity to real code. It involves `INPUTS`, `OUTPUTS` and `EVENTS`.
# Inputs
An input is any data that could be received. It could be a thing that could sensed (seen, heard, tasted, felt or even smelled), or specific data that is delivered. Regardless, whatever we sense or receive has a `value`. Values could be:
- a phrase or some text
- a number
- a true or false statement
- a color or a shape
- a position or location
# Outputs
An output is anything the code produces and where it is produced. For computer programs, it can be produced by "printing" something onto the screen. For robots, it can be produced by conducting some time of action. Some possible outputs include:
- print text to the screen
- moving from one spot to another
- rotating from one spot to another
- stopping what was already being done.
- waiting for an event to trigger.
# Events
An event is anything that causes a code to do something. An event can simply be "start this script". An event can also be any other input changing, such as when a street light turns green. That event "triggers" the code to run. Some example events include;
- someone requests the webpage that your code makes
- a shape moves in front of the camera
- a bell rings
- a taste sensor senses cilantro
- a key is pressed
- an H2S monitor senses sour gas
In these cases, the input causes the trigger, the code then operates and produces an output.
# Conditions and Controls
Sometimes the code requires additional details about the inputs to decide exactly what output to produce. Therefore the code needs ways to manage its responses based off the inputs it uses. One of the most common ways to do so are through `if ... else if ... else` conditional statements.
```
if light is red {
stop.
} else if light is yellow {
sense if already in intersection
if in intersection {
go
} else {
stop
}
} else {
go
}
```
# Sample Pseudocode
For a full example of Pseudocode that describes the algorithm for crossing a crosswalk, view https://docs.google.com/document/d/1mNenJtIZjHv0eLK8c2B2A1skHZYmyPO8S_3D16XioUk/edit?usp=sharing
# Assignment 2 - Pseudocode
Complete the assignment in Google Classroom where you produce your own Pseudocode for unlocking a locker.