Smartick is a fun way to learn math!

Feb06

# Basic Coding Concepts: Instructions and Control Structures

In this post, we will talk about the first setting that is presented to students to learn how to code.

We decided to teach these first steps through robotics, which is the branch of programming that is closest to the physical world and more attainable at an early age. The first thing that we work on during coding sessions is how to handle Robby. The robot moves on a grid that allows students to learn how to orient themselves from an isometric perspective.

The first language that children face in Smartick Coding is block coding which is written horizontally on a grid. In order to do this, different instructions and control structures are used.

As the curriculum progresses, they go on to write code vertically as traditional programming languages are written.

### Instructions

The first blocks that a child learns to use are the Advance, Turn and Action blocks.

When a child uses this block, Robby moves forward one space.

#### Left Turn Block

The child uses this block to have Robby make a 90 degree turn to the left.

#### Right Turn Block

This instruction has Robby make a 90 degree turn to the right.

#### Action Block

With this block, the child can have Robby perform a predetermined action: push a button, pick up an object or use an object he already has.

### A Little More Complicated: Control Structures

There are three control structures: Sequence, Loop and Condition. We will explain what each one consists of and how we introduce them in Smartick Coding.

#### Sequence

A sequence is a collection of instructions. For example, with the sequence below, we will have Robby advance two spaces, turn right, advance one space, turn left and complete an action.

With the four basic instructions (advance, right turn, left turn and action) we introduce and work with expanding the concept of a sequence. Which is as simple as it is essential in programming. When we write a sequence, the order in which we give the instructions is how the robot will execute them. We encourage the child to reflect on how to instruct the robot to have him reach the goal at each level. We gradually introduce complexity by making the path more complicated or bringing in more distracting elements. Trampolines, teleporters, ice blocks or rocks that Robby has to break are put in between the robot and his goal. As a result, little by little, the child has to create sequences that are more and more complicated.

#### Loop Block

When sequences increase in length, we present longer codes to the child. Part of the sequence will have to be repeated, so we introduce the following structure into the curriculum: the loop.

Therefore, the loop is a repeating sequence. In this example we have an Advance Block, Right Turn Block and an Advance Block that is repeated three times consecutively:

The child needs more powerful tools to solve the situations being presented so we offer them the loop block. This causes them to process pattern recognition to be able to find the same code, in the form of a loop. The first loop presented in this setting is the for or repeat loop, which the child can use to indicate the number of times they want a code sequence to repeat:

#### Condition Block

As children become more comfortable working with loops, we introduce the third key resource in coding, the condition. To do this, a bridge is added to some levels that may be raised or lowered. However, when the child is writing the code they do not know the position of the bridge. For this reason, they must enter their code with conditional instructions that allow Robby to raise or lower the bridge by pushing a button depending on the route he needs to follow. We use these exercises to naturally and transparently start working on Boolean logic with the child. Saying it is not raised is synonymous with saying that it is lowered just as saying not lowered is synonymous with raised.

In this post, we have seen the basic concepts of programming that we work on in Smartick Coding. In the next post, we will talk about how we work on these concepts by analyzing the different types of problems that we have developed.