THP Logo THP

Learn THP & programming

In this series of pages we'll go at learning to program, from absolute basics. This series of articles is intended for beginners.

Users of other langs can see a high overview of the syntax & features at the Docs, or the stdlib API.

What is programming?

At its most basic level, I like to think of programming as creating a recipe that a computer follows.

Like a recipe for a chocolate cake, there's ingredients, tools, steps, times, etc. In a program there's data, tools, steps, timings, etc.

But the crucial distinction is that we are not following the recipe, we are creating it for the computer to follow.

From wikipedia: Computer programming or coding is the composition of sequences of instructions, called programs, that computers can follow to perform tasks

What is a programming language?

The recipes must be written in some language. For you it might be English, for others it might be French, Arabic, Chinese, etc. For the computer, it might be C, Python, Haskell or THP.

Those are some of the languages that the computer speaks, and when we write our recipes, the words we write follow their rules.

What do they look like? Honestly, it's kind of scary at first:

#include <stdio.h>

int main() {
    printf("Hello, world!\n");
    return 0;
}

Unlike english, there's a ton more symbols, many of which you might have never used: # < > ( ) { } " \ ; . ,. Fear not, however, for you'll see that there's different languages, some easier than others, and once you pick up the basics it will all make sense, and you'll be able to write them.

For this tutorial we'll use the THP language, which is a lot more easier. It looks like this:

print("Hello, world!")

What do I do with the program?

Ok so say you've written the program, the recipe. What do you do with it? How do you make the computer run it?

For this there are tools called "compilers" that take your program and run. You can search them in the internet, like "C compiler online" or you can download the compiler to your computer and run the program there (harder).

For the THP language we will use, you can write and run your program right here. Click the "Run" button in the code below and see your program run.

print(42)

What's next?

Now you have a sense for what is programming. From here, we'll begin to learn how to program, how to write the language, and the logic required.