Core Concepts I

This is part of “An intro to Coding” series of posts, with content from the Enki app. If you stumbled upon this, you can start from the beginning.

Let's quickly introduce the building blocks we'll cover in this course.

Program

Even though they're super fast, computers are annoyingly literal - you have to spell out everything for them.

A program consists of one or more commands we're asking the computer to do. It's a sequence of specific tasks. A list of TODOs for the computer.

Variables

For a program to remember values, it needs a place to store them.

This is where variables come in. They serve as storage containers for data.

Data Types

Computers don't know always know the difference between 1 and one. Sometimes we have to help them out.

Using data types, we can mark data with a label that helps the program know the kind of value it holds, such as a number, text, etc.

This is useful because text doesn't have the same capabilities as a number. For example, what's the square root of cat?

Organizing behavior

Using functions we can organize commands into groups and give each group a name.

For example, if you had a program that was meant to simulate a person going for a run, you might have a function called goForARun that makes use of the following commands:

  • lift left leg
  • lift right leg
  • inhale
  • exhale

The function goForARun would now be a new command in your program that consists of 4 subcommands.

Sharing functionality

New commands created with functions can be used anywhere in the program, many times if needed.

For example, you could use the command goForARun anytime your user presses the controls to speed up their game character.

Easier to read

Just like organizing a book by chapters makes the book easier to read, so does organizing your program into functions.

Functions give the program structure.

💡 You should give your functions explanatory names to make it easier for the reader to understand what they do.

Andrei Calabangiu

Content Manager

About Enki

  • AI-powered, customized 1:1 coaching
  • Fully customized to team needs
  • Pay only for active learners and results

More articles