If you’re ready to introduce your student to programming but have no idea where to start, and aren't a programmer yourself, have no fear! In this article, we will detail the basics of coding for kids, across all languages. The best part is you don’t actually need a computer to go over these concepts with your student.

Learn the basics of coding for kids

Explore programming basics for kids with these ten core concepts.

1. Variables can change values

Key to any programming language is the concept of a variable, or a piece of information that can have its value change throughout the program. There are a near infinite number of examples you could provide your student with, but the concept is the same: a programmer makes (declares) a variable at the start of a program with some, or perhaps no value. Later on by referencing that same variable by name and setting it equal to something, the value can be changed.

As an example, you can declare x = 5, at the beginning of your program. Later on, based on some condition or outcome you can set x = 7; the value has now changed and the rest of the program will reflect this change. For a more concrete example, take the weather: at the start of the day, the temperature may be low but gradually increase.

To learn more about variables, and core coding concepts such as sequence, loop, and conditional with live expert guidance, join our free beginner-friendly Scratch coding class and Scratch camps:

2. Conditional Statements only happen if..

A conditional statement is exactly what it sounds like; it will only happen or occur if the condition is true. You can relate this to your student through everyday life by the way you might ask them to do chores. For example, a parent might say, “If you clean your room we can go to the movies tonight.”

An if statement can quickly become more complicated and varied, just as in real life. For example, “If you clean your room, do the dishes and get an A on your homework, we can go to the movies”. A programmer, in the same way, can control when certain things happen. For example, when the players variable myScore reaches 10, perhaps there should be some sort of display on screen

if(myScore = 10)




3. Control structures can work forever

Similar to an if-statement, there are a number of other control structures present in most languages. We won’t go into the details of them here except to show an example. A do-while loop executes a certain part of code repeatedly, as long as a certain condition is met. It’s in the name! DO something WHILE something else is true.

For example, do increase the score of the player as long as they are ‘King of the Hill’. Along with if statements, these control structures help the programmer navigate when certain events take place, how to account for results outside of the intended scope of the program and how to execute some code continuously.

Via Geeks for Geeks

4. Data types: apples with apples, oranges with oranges

When creating variables, students will also have to declare a data type, that is what kinds of value can be assigned to the variable. In the previous example ( x = 5), most likely only numbers can be assigned to x, and only whole numbers at that. This should come naturally to students who can easily think in terms of categories. For example, a lizard is a reptile, and a dog is a mammal. If reptile and mammal were data types, you would not find lizard under mammal. The distinction is as easy as separating letters from numbers. The image below does  a great job of summarizing this concept.

Via Hanamon

5. Data structures can hold more than one value

Across most programming languages there exists the concept of a data structure. Don’t let your student ( or yourself) be intimidated by the big scary name, simply explain that a data structure is a bigger variable. Where normal variables have a one to one relationship ( x = 5 and only 5), a data structure can hold more than one value under it’s name.

Most likely, they will encounter arrays before any other data type. An array can be written like so x = [5, 7, 3, 2]. In the array, the order matters and each value corresponds to what is called an index. If you don’t want to go into detail, just reach back to your student’ knowledge of categories.

For example array fruit = [“apple”, “orange”, “banana”] or array trees = [“pine”, “spruce”, “oak”]

With most of the more complex concepts out of the way, we would like to devote some of the article to helpful reminders. These are not programming concepts per say, but more guidelines to gear your student toward success.

6. Syntax, spelling matters

In every programming language, case-sensitive is important, even if it’s just for legibility. myScore, and MyScore are two different variables. Perhaps the most common error students will come across is typos and something as simple as missing a letter can prevent an entire program from executing. For this reason, before students even start programming, reinforce the importance of spelling, capitalization and correct punctuation.

7. You need tools to build a house

Another common concept across all programming languages is the use of an integrated development environment (IDE). In most cases, we can’t just program in a vacuum, meaning we need a special program or software that is capable of interpreting your code as actual instructions for the computer. IDEs are great for debugging, intelligent text prediction, tool tips and a thousand other small functions that you won’t even know about until you need them. You can prepare your student for success by getting them to understand that code alone is not enough; a software program or IDE is required to turn your code into action. Even browser based programming is relying on some installed technology. By making this reality clear, your student will be better equipped to deal with tech problems and determine whether the issues lie with their code and syntax or something else.

8. Debugging is a part of programming

The first time you sit down to write code you will likely see a large amount of red squiggly lines across your screen, underlining various terms. Tell your student that these are bugs or errors and are as unavoidable as your shadow. This may not seem important but the more a student can normalize dealing with errors and bugs, the better programmer they will be. Every coding instructor has witnessed the frustration and break-down of an otherwise brilliant student when presented with code. A large chunk of most programming sessions will be devoted to picking through code and seeing what is misspelled, or misplaced. For these reasons, a good robust IDE can be a boon.

Debugging in programming for kids

9. Comments, smart people talk to themselves

Comments are characters in  a program that are not compiled or read by the computer. In other words, comments exist for the sole purpose of making code more clear to the programmer. Every language supports comments, usually with the use of backslashes or asterices or the combination thereof (*, / ). The idea behind a comment is similar to an essay outline: the writer should have a loose understanding of what they're trying to accomplish in a program and how that might be done. We encourage students to go through a program first and “pseudo-code” or write what they think the code will look like in terms they can understand, without concern for syntax. This practice is especially useful in more complex control structures with nest if-statements. Later, students can go back and fill in the details with particular methods.

In real life, get your student to practice this thought process by embarking on a project together. As your student is going through the motions, ask them to say, write down or think aloud about the step they are doing.

10. Iterate, iterate, iterate

Practice makes perfect is the adage that comes to mind when thinking about programming for kids online. To be taken hand in hand with debugging, the process of iterating a program is crucial. It’s likely that students will set out to accomplish a particular program, finish it and then find it suddenly lacking. This should be encouraged as it means that they are thinking critically about the best way to accomplish their task, and upon review have found certain inefficiencies or places where the code might be made more clear. This iterative process also mirrors writing multiple drafts of an essay, and the writer can use comments or suggestions to improve their writing each time.

Here’s an example of coding

This example will serve to illustrate the first principle regarding variables and how they can be changed throughout the runtime of a program. To begin lets make an integer variable called myNumber and set it equal to 7.

int myNum = 7;

Note that myNum can only accept integer values, so if we attempt the line of code below, we will get an error.

myNum = ‘apple’;

‘apple’ is a string of characters and is of a different data type than an integer. Later in our code we can change the value of myNum to be almost whatever we want, like so:

myNum = 10;

From that point forward in the program, myNum will have this value.

Free and cheap coding websites to get started with coding

  • Create & Learn: Create & Learn is an educational platform made by professionals with experience in the tech industry. The variety and quality of live online classes offered make it a top choice.
  • Khan Academy: A free website with tutorials on a range of topics including math lessons and coding basics.
  • W3Schools: Another website where you can learn using a bunch of free tutorials for more advanced coding in HTML, CSS, and more.
  • Free Coding Games for Kids: Check out challenging games for kids from elementary school through high school to learn coding.

Get started with the basics of coding for kids

You can start with the above principles outside of the classroom, to get your student geared up for learning. For guidance from a live expert and a structured curriculum designed by experts from MIT, Google, and Stanford that empowers students to succeed, join our beginner-friendly free Scratch course (grades 2-5), or free Accelerated Scratch course (grades 5+).

Written by Create & Learn instructor Jack Stewart. Jack experiences the world  through travel and storytelling. He incorporates his travels into his creative works including coding, story writing, and game design. He aspires to impart to his students the tools they need to also bring their creations to life.