It seems quite overwhelming when someone starts programming. So many questions you may have. You will choose the first language you learn for whatever reason. Maybe you had read that it is the best language ever or maybe a friend suggested it. It doesn't matter. You most probably would change languages soon for another reason. The procedure of learning a language is usually the same. First, learn the words that the language uses. Create your first program. Many questions in your head that are never answered. You just continue following the things you are reading in your turorial, and trust that some day everything will make sense. And it magically does. In some people like myself, it is a slow and painful process.

The language in question in this book is called gdscript. But I would like to start with a generic part about programming languages and then touch gdscript.

Every programming language has some words. They are very few though. I'll create a fake programming language just to show some examples.

Our language has only 1 word. The word 'plus'. The numbers are also words in the programming languages. So we have the words:

Some sentences of that languge could be Those seem good sentences but quite useless. When you start programming you usually write boring stuff like this. In these sentences you mean that you add two numbers together. Usually the computer will show you magically the number you asked. One important thing to understand about programming languages is that they are made to be read by humans and not by machines. The machine doesn't know how to read the sentences that you write in the programming language. More about this later. I'll write some bad sentences now: Those sentences don't make sense for a human. I don't know what would someone want me to do if they wrote something like that. But I also have a lot of imagination. I could imagine what someone wants to say with these sentences. Let's not go there.

So we established now that languages are made to be read by humans and not your computer. And also that numbers are also words and not numbers. But then how the computer understands what you wrote and adds the two numbers and shows you the result? The answer is the compiler.

The compiler is another program that someone else wrote, usually the makers of the language, that reads the words you wrote and translates them to something a machine understands. Compilers are quite like humans, they read words from start to end and try to make sense what you wrote. They know all the words of the language and lots of combinations you can use with them to make sense. Many combinations of words that would make sense to a human will not make sense to a compiler though.

So the compiler reads what we wrote and translates it to something the computer can understand. It is numbers, right? But how can you translate a sentence to just numbers? Nope it is not just numbers, it is words. Yes the computer understands words like you, but those words contain only numbers. Maybe a computer instead of the word 'plus' understands the word '1322348' for plus. But you would need to write '1 1322348 2' every time you want to add two numbers, and that is ugly. Not to mention that even the words '1' and '2' are different words in the language of the computer.

So we continue writing in our beloved languages and let the compiler translate it to whatever language the computer understands it.

But you say programming languages are also ugly and you are correct.

It's true, humans don't speak with sentences like 1 plus 2. We may say to another human 'Please add the number 1 to the number 2 and tell me the result.' Well that's too many words to write and nobody has the time for all that. In programming languages we try to minimize the words we would need to type. Even the word 'plus' seems too long when you can just use the word '+'. Remember everything is a word in programming languages even the numbers and the symbols.

Of course programming isn't just adding two numbers. You can't make games with that. How do you go from adding two numbers to creating a complicated thing like a videogame? Well it's complicated. It is really complicated though. But most of the time someone else did the most work for us. That's why you would use a game engine like godot instead of one of the popular programming languages that exist for your game. To answer this, I would like to add one more word to our language and then try to answer.

One of the most important things a programming language lets you do is naming things. Creating new words! Words that the compiler understands. I'll add a new word to our programming language, the word 'name'. I added it because I want to give names to sentences. So instead of writing 1 plus 2 I would write

or with even less letters and the compiler would understand what I mean.

Why would I give a name to a sentence? I may have to use this sentence many times in my program so I don't want to write '1 plus 2' every time.

So using this new word 'name' in my program I would write:

and then instead of writing '1 plus 2' I would just write

The word doesn't have to make any sense or be an english word, it may be any random letters, it doesn't matter. But I can't use for a word another word of the language. I can't name the new sentence 'plus'. Like us humans, the compiler wouldn't know if you want to use the sentence or just wrote plus by mistake.

So to return to the question, how do you create a videogame, the people creating godot have named lots of sentences. So that you can use those names instead of writing your own sentences. You don't know exactly what those names do under the hood, and most times you don't care, you just want to make games using the names you are given.

In some ways programming is just creating words and then adding two numbers.

Of course a programming language doesn't have only the plus and name words like ours, otherwise you couldn't make lots of things. So lets continue to the next chapter that presents the programming language the godot engine uses, gdscript.