basics 'Keywords' 'Operators'

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By gamecode

this link GDScript reference — Godot Engine (stable) documentation in English

has weird strange terms

‘keywords’ ‘operators,’ literals, ‘types,’

that nobody in this world or on this web knows what they mean

what links has youtube vids or gifs

of what these things ‘keywords’ ‘operators,’ literals, ‘types,’ do?

  1. like do you use ‘keywords’ ‘operators,’ literals, ‘types,’ in the same way?

  2. are ‘keywords’ ‘operators,’ literals, ‘types,’ all in the same part of the code syntax ?

  3. etc etc

:bust_in_silhouette: Reply From: Lopy

The list you are referring to seem mostly oriented toward people having coded in other languages, for them to see the exact spelling of things that they are used to. For instance, some languages use ‘text’, `text`, and “text” depending of the situation, this page tells you that gdscript prefers “text”.

The distinction between keyword, operator, etc, is mostly there to give titles for the different sections. You probably do not need to care about them.

If you want to learn how to use gdscript, and Godot in general, I recommend you to use a tutorial, like the Your First Game in the documentation. There are plenty of other ones, including videos, if you prefer.

PS : If someone was really looking for the full gdscript grammar, here is the (unreadable) EBNF, do not use this to learn gdscript.

:bust_in_silhouette: Reply From: Szesan

When you dip your toes in an unfamiliar craft or field of research the first thing you have to come to terms with is that you need to learn the terminology of the given field to proceed. That’s just how it is. So don’t be intimidated by the “weird strange terms”, but learn what each of them means instead.

keywords are “words” which have a specific, predefined meaning in a given programming language, such as “func” or “var”, “extends”. So you cant have a variable named “func” because it is reserved for the predefined role.

operators are predefined functions in a language. They are used to express basic data manipulations or relations between values. Operators are like “+”, “-”, “%”, “<”, “>”, “=”

literals are literal, fixed values.“32” for example is a literal. 32 is a possible literal value of an int type.

types are the different kinds of data you want to store. If you want to store text for your label you are going to use a string type. For the numbers of laps in your racing game you want to use an integer type, which are like whole numbers.

These are not precise definitions and there is a whole lot more to say on each, I just wanted to make sure you have basic idea about these terms. I hope it helps a bit.