The application of each step of an algorithm in the order in which the code statements are given

The application of each step of an algorithm in the order in which the code statements are given

NOTE: Learners are introduced to the concept of sequence in the world of Smeeborg. To learn more about sequence and other concepts, check out the full learning guide for Smeeborg --> click HERE

People are smarter than computers. We decide what actions we want a computer to carry out, and then we communicate in a language the computer understands in order to complete tasks. We call this language “code”, and we instruct the computer using specific commands.

Definition: 

Sequence, the order that commands are executed by a computer, allows us to carry out tasks that have multiple steps.

In programming, sequence is a basic algorithm: A set of logical steps carried out in order. Computers need instructions in the form of an algorithm in order to complete a desired task, and this algorithm must have the correct order of steps, or sequence.

Example: We can relate sequence to our everyday lives. Think about making a PB & J sandwich as a task, for example. If we want to make a delicious, peanut butter and jelly sandwich, we need to follow multiple steps in a logical order. We would begin by gathering our ingredients, getting a knife, spreading the peanut butter, spreading the jelly, and so forth.

If we wanted a robot to make a peanut butter and jelly sandwich for us, we would need to make sure we gave the robot instructions in the correct sequence to avoid missing a step, not having all the ingredients we need, or ending up with an inside-out sandwich.

Application: In programming, computers can only carry out tasks that are in the correct sequence. Computers are MACHINES and they have to do things the way they were built to do them.

In Kodable, the fuzz needs to be given instructions in the correct sequence to get through the maze. Using arrows as commands, we need to give the fuzz instructions in the correct sequence, or the fuzz will hit the wall of the maze.

Computers read in a certain order; similar to a typewriter which can only go left to right and top to bottom. A computer has to read code in order. If the sequence of the commands is incorrect, the computer won’t be able to follow the instructions.

Why is Sequence Important? In both programming and day to day tasks, if we don’t put every step in the right sequence, the end result isn’t what we wanted. Sequence is the most foundational concept in programming, and everything we learn moving forward will build on this concept.

If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.