Educiator notes: This section is designed to introduce your students to the coding concepts that they are going to use in the upcoming coding project. For more information on Coding Concepts refer to the On boarding course here.
In coding, there’s a tool called the “If-Then” block that lets us give special instructions to computers. Imagine it’s like deciding when to use your umbrella. ‘If it’s raining, then take out your umbrella.’ So, if the sky is pouring, you’ll use the umbrella, but if it’s sunny, you won’t. In the same way, the computer follows the If-Then rule to decide what to do. By adding more directions inside this rule, we can make the computer do all sorts of tasks depending on different situations!
In coding, we often need to remember or keep track of certain pieces of information. We use something called a ‘variable‘ to do this. Imagine a variable as a special kind of backpack. Inside the backpack, you can put different items, and you can also take them out or change them. Just like you might put a book in your backpack today and a lunchbox tomorrow, a variable can hold different data at different times. So, a variable is like the computer’s backpack, helping it remember and carry the information you give it!
In coding, we sometimes want a computer to do something only when we tell it to. For example, in a game, we might want a character to jump when we press a certain key on the keyboard.
There’s a special block in coding called ‘key() pressed’. Think of it like a light switch. When you press the right key, the switch turns “on” (which we call “true”). This tells the game, “Hey! Make the character jump now!” If you don’t press the key, the switch stays “off” (which we call “false”), and the character doesn’t jump.
In programming, a ‘Forever’ loop, or infinite loop, constantly runs a segment of code without stopping. Think of it like a playlist with one song set to repeat endlessly. Unlike typical loops, which run for a set number of times or until a condition is met, a ‘Forever’ loop keeps going until externally interrupted. For example, web servers use these loops to always listen for incoming website requests. They keep checking non-stop, ensuring they catch every visit without missing a beat. While unintended infinite loops can cause issues, when used purposefully, they’re invaluable.