By Codomo Singapore

How To Learn Coding With These Fun Byte-Sized Comics

Welcome to Coding with Carbs! This is where we try to break down daunting programming concepts into byte-sized digestible information that is relatable to the average joe! These comics provide a great way on how to teach kid coding concepts when they are as young as 6 years old. You can also use educational board games or toys designed for introducing programming to kids. There are plenty coding games for kids you can try.

What is Coding?

Coding or computer programming is the medium we use to communicate with computers. The code we write acts as a set of instructions that tells a computer what actions to take. Just like languages around the world, there are multiple programming languages to write the instructions in. Different grammar rules and "sentence structure" apply in different programming languages, however, the programming concepts and logic remain universal across the different languages. We will cover the most fundamental concepts that you'll learn in your first 10 hours of learning computer science.

Key Computer Science Coding Concepts

1. Variables

Similar to the variables often used in mathematics, they are containers for values that can change. You can think of them as buckets to put your coins in. Card games for kids can also help you explain this concept in a fun way. If you’re interested in designing your own coding card game, you really should take a look at our guide here. 

Variables = Buckets

Bucket A can contain 10 coins but if add 2 more it could contain 12, the number of coins inside Bucket A can vary.

Potato Pirates explain coding concept, variable

2. Data Types

There are multiple types of items (data) you can store in the bucket (variable).

String

Alphabets, words, phrases, and punctuation can all form a string. String are usually denoted within the quotation marks "". Just imagine it as a chain of alphabets beads that are strung together to form your name. 

Potato Pirates explain programming string

Numbers

They work exactly like how numbers should work.

Integers

An integer is a whole number, that can be positive or negative. They must not contain decimals.

Potato Pirates show what is integers in programming

Float

Float is used to represents number with decimals. 

Potato Pirates explain meaning of float in programming

Boolean

Values that can be either true or false. They are usually used within a control flow's conditional parameters to determines the course of action.

Potato Pirates explain boolean in programming meaning

List/Arrays

Arrays are used to store multiple values in a single variable. As you can see, the drawer is the variable that is storing an array of numbers. The type of data (numbers/strings/float) drawer (variable) contains has to be the same.

Potato Pirates show meaning of array or list in programming

3. Sequential logic

Actions occur one after the other, hence, the result from the previous action would potentially be required or affect the the outcome of the subsequent actions. The Contrast to it is the combinational logic.

Learn Sequential logic in programming easy with Potato Pirates Comic

Still here? Nice, we can take a break and talk a bit about how to teach kid coding (other than through this comic!). 

Allow me to ask just one question, have you prepared computer for your kids? It’s ok if you haven’t (not urgent for a 6 year old child anyway). No need to rush cause we also have a guide to teach coding without computer as a start. So you can give them computer later on when they’re ready.

Now, let’s back to the comic!

4. Algorithm

A set of instructions to command a computing machine. An analogy would be a step by step recipe to cook a particular dish. You simply follow the instructions on the recipe to produce the desired dish.

What is algorithm in computer science programming, explained by Potato Pirates

5. For loops

Execute a set of actions/instructions an exact number of times. This is ideal for when you want to save time and let the computer run the same code over and over again without repeating it yourself.

An example would be running a 2.4km run on a standard stadium track.

Run 1 lap = Action that needs to be repeated

The same action that is repeated is 1 lap of 0.4km around the track.

Teacher = Coder

Instead of telling students to run 1 lap, run 1 lap, run 1 lap, run 1 lap, run 1 lap, run 1 lap, every time they pass the start line, the PE teacher could simply say, run around the track for 6 times.

Students = Computer

The students would repeat 1 lap around the track a total of six times before coming to a stop.

Potato Pirates explain for loops in programming computer science

6. While loops

While loops are used when you want to repeat the actions while given conditions are true.

An example would be if you would like to find a particular book on a shelf that has multiple rows.

While book not found -> look for book

Book is not found = Condition given that is still True

Look for book = Action that is repeated

You will repeat the action of looking through the bookshelves row by row for the book because the condition is still true.

However, once you find the book, the given condition of book not found would end up being False, hence, you stop the action. 

Potato Pirates explain the meaning of while loops in programming

 

7. Nested Loops

Nested loops means that the instruction given within a loop is part of another loop.

Let's say you are a competitive eater and want to finish eating 20 boxes of cookies with each box containing 10 cookies.

You would first open up a bag, then consume all the 10 cookies, and repeat this with the other 19 boxes. 

For 20 times, (Outer loop)

Open the box, (Instruction 1)

For 10 times, (Instruction 2) (Inner loop)

Eat 1 cookie 

In this case, the first action would be to open up the box, then the second action is the nested inner loop where you consume 1 cookie for 10 times. Once 10 times is up, you will move on to the opening the next box.

The nested inner loop could also be written as a While loop.

For 20 times, (Outer loop)

Open the box, (Instruction 1)

While there is still cookie (Instruction 2) (Inner loop)

Eat 1 cookie 

This would mean that within instruction 2, once there is no more cookie, the loop will stop and you will open the next box

Potato Pirates explain Nested Loops in programming instruction

8. If Else

A control flow that enables two choices based on a specified condition. An easy way of how to teach kid coding is by giving an example. Let's say there are only two items on the menu for lunch, a sandwich which costs $5 and a burger which costs $3. You check your wallet for the amount of money you have, if the amount of cash you have is more than $3, you would go for the sandwich, otherwise you would settle for the burger instead..

Meaning of if else in computer programming explained by Potato Pirates

9. Logic Operators - And/Or

They are used to evaluate 2 expressions as one. The resulting boolean value between the expressions changes according to the table shown below.

Looking at Expression 1 AND Expression 2 as one means that BOTH expression must be True in order for the boolean value to be resulted as True

Looking at Expression 1 OR Expression 2 as one means that just 1 of the 2 expressions need to be True in order for the boolean value to be resulted as True

Expression 1:  10 is bigger than 5  (Statement is True)

Expression 2: 3 is smaller than 1 (Statement is False)

In this case if we stating to check that Expression 1 AND 2 must be True, the resulting boolean will return a value of False because Expression 2 is a False statement. 

If we are stating to check either Expression 1 OR 2 has to be True, the resulting boolean value will be True since Expression 1 is already True.

10. Switch

A control flow that enables multiple choices based on a specified condition. An alternative would be a sequence of repeating if-else. Let's say for example there are now more than two options on the menu and you are only looking to spend all your money on 1 item. There is sandwich that costs $5, a burger that costs $3, a chicken rice that costs $4, a hotdog that costs $2, and nuggets that costs $1. You check your wallet for the amount of cash you have and depending on the amount of cash you have, you would pick the respective meal.

Meaning of switch in computer programming explained by Potato Pirates

11. Break

A programming keyword that is used to force a loop to terminate/forcibly exit a loop. For example in a classic car race, the only way to terminate the laps early is when some parts of the car break. Only then will your car be able to leave the laps.

Programming keyword break meaning explained by Potato Pirates

12. Interrupt

A signal sent to a processor that causes it to pause and figure out what to do next.

Potato Pirates explain Interrupt in computer programming

13. Throw

A Programming keyword that is used to call out an exception. Think of it as delegating the issue to someone else to handle or throwing your responsibilities to someone else to resolve.

Potato Pirates comic on explaining throw in programming

14. Bug

A technical flaw in the program that results in the unexpected or unwanted results. Coding games for kids or educational board games usually also explain this and some other computation terms.

What is a bug in computer science programming, explained by Potato Pirates

15. Try-catch

A form of exception/error handling. Programming code are first tested under the try clause, if there are errors, then the code under the catch clause will take effect. Let's imagine you are a secret agent and you want to escape through the window after you have gathered intel. You tried to open the window but it was sealed on tight, as a backup measure, you decided to escape through the air ventilation chamber instead.

What is try catch in programming, explained by Potato Pirates

16. Functions

A function is a block of code that only runs when it is called. You can pass data, known as parameters, into a function. A function can return data as a result. 

Functions in computer programming, explained by Potato Pirates

17. Recurse

A function that calls itself until its base case is met. An example would be lets say you want to display 6 dolls on a shelf and you are given a Russian doll with 5 other dolls within it. You would first open it one by one until you reach the smallest inner doll, then you place the smallest doll on the shelf and start to replace the lid of the second smallest doll and place that on the shelf. You then repeat it for the third smallest doll and so on and so forth. After repeating it for all the other dolls, you would eventually end up with 6 dolls on the shelf.

Potato Pirates comic on meaning of recurse in computer programming

We hope you have enjoyed these byte-sized comics, they are also the perfect teaching resources for you teachers out there who want to use a fun way to introduce the concepts.

Check out our free teaching and learning resources that put these concepts into practice on various programming languages such as Java, Python, and Swift. You can also try our coding card games for kids Potato Pirates 3: Battlechips to introduce fundamental computational thinking concepts in a gamified and fun way and begin your computer programming journey.

0 comments

Leave a comment

Please note, comments must be approved before they are published