Share this article!

Coding may seem like a daunting task when you first explore it, whether as an educator or student. There are if-statements, conditionals, loops (not the fun rollercoaster kind), and a whole host of other concepts to learn.

But we experience some of these coding concepts in our everyday lives, and we may not even realize it. As educators, we can discuss these everyday experiences with our students and make the concepts relatable for better retention and to promote an innovative mind.

This article will describe some basic coding concepts for students and provide examples of them in real life. Educators can take this knowledge back to their own classroom and start having these discussions with their students to introduce coding concepts. This article will also help get the creative juices flowing to lead to even more creative coding education.

Getting Started with Coding Concepts

If you simply search for “coding concepts” on the internet, you will get a ton of hits. I certainly encourage you to explore some of those, but there are a few coding concepts that I feel are a great starting point for any new coder: if-statements, conditionals and loops.

For the purposes of this article, if-statements and conditionals go hand in hand, and we will focus on for-loops. These concepts are foundational to any programming language and can be found in almost any type of computer program.

If-Statements and Conditionals

In its simplest form, an if-statement is used to tell a program what to do based on a certain condition, and the action that takes place due to that condition is considered a conditional—”if x (condition) is true, then do y (conditional).”

Within a computer application, an example is “if the user clicks the X button (condition), then close the program (conditional).” Essentially, an if-statement in coding is the equivalent of a decision being made by a human.

For-Loops

A for-loop in coding is something that helps a program repeat an action for a certain number of times or iterations. For example, “do x (the action) y number of times (iterations).” An example within a computer program is “make a beeping noise (the action) four times (iterations),” which could let the user know there is an issue.

A for-loop can be related to a human repeating the same action multiple times to accomplish something, like hitting a nail with a hammer five times to drive the nail into a board.

Real-life Examples of Coding Concepts

With knowing some basic concepts of coding, we can now brainstorm real-life examples, specifically for students, of these coding concepts.

If-Statements, Conditionals and Deciding What to Wear

A student may wake up in the morning and decide what they are going to wear for the day. They ask themselves, “Do I need a winter jacket today? Let me check the temperature. I will wear a jacket if it is colder than 50° F.”

At that very moment, the student has set a condition and has to make a decision based on that condition. The condition is the temperature (is it warmer or colder than 50°F?), and the decision or conditional is whether or not to wear a jacket.

This is exactly how a simple if-statement is designed in coding. As educators, we can have a discussion with students on what decisions they have made throughout the day. What did they base their decisions on (conditions)? What were they going to do (conditionals)? Then we can apply that experience to the coding concept of if-statements and conditionals.

For-Loops and the Lunch Line

Another great example is going through the lunch line at school. What do students do in the lunch line at school? Simply put, they order food, get the food and checkout. This is the same for each student in line from the first student in line all the way to the last, whether there are 5 or 500 students in line. So how does this relate to coding?

First, what is done in the lunch line is repeated by each student, much like code is repeated in a for-loop. Also, these lunch line actions are repeated only a certain number of times (for the number of students in the line), just like a for-loop will iterate for a certain number of times in coding.

In a discussion with students, educators can ask questions like “what actions take place in the lunch line (repeated code)? How many students are in line (number of iterations)?” Then we can apply that experience to the coding concept of for-loops.

How have you “coded” today?

Now, there are many, many more coding concepts (arrays, functions, while loops, etc.) and real-life examples that can relate to them throughout our daily lives.

With a foundational knowledge of coding concepts, we as educators can be creative and have discussions with our students about how daily experiences could be related to coding. These discussions can also be a great supplement to an already existing coding course. How have you “coded” today?

This article was originally published in May 2020 and has since been updated for content.

Benjamin Leskovansky Learning.com contributing author

Benjamin Leskovansky

Staff Writers

Benjamin Leskovansky is a middle school computer science teacher at Insight PA Cyber Charter School in Pennsylvania. He previously taught game design and served as head coach of eSports for the school. Benjamin has a passion for business, technology, and education and loves sharing his knowledge with others through instruction and collaboration.

Further Reading

Further Reading