Type

2025/12/27

Type
Learning Resource
Format
Glossary Article
Version
General
Subject Tags
Code
Assets
All else
Copyright 2016-2026, GDQuest
Created
2026/02/16
Updated
2025/12/27

Type

In computer programming, a type, also called data type, is a set of rules that groups values together. It describes which values are part of the same group and what operations are available for them.

Concretely, in Godot, vectors, nodes, numbers, strings, and more are types: int, float, String, Vector2, Sprite2D, Timer...

When we say that a variable is of a certain type, we mean that it can only hold values that are part of that type. For example, a variable of type int can only store integer values (whole numbers).

Often, when we use keywords like Vector2 in GDScript, we are referring to data types. For example, when we write a type hint to indicate the type of a variable or of a value returned by a function: var offset: Vector2.

However, Vector2 is also a class. In short, a class is a concrete implementation of the Vector2 type. When you construct a new Vector2 value, you are creating an instance of the Vector2 class. For example, the code Vector2(100, 200) creates a new instance of the Vector2 class with the x and y values set to 100 and 200, respectively.

This means that Vector2 is a type, but it is also a class:

The close relationship between types and classes can be confusing. In practice, developers often use the two terms interchangeably.

Become an Indie Gamedev with GDQuest!

Don't stop here. Step-by-step tutorials are fun but they only take you so far.

Try one of our proven study programs to become an independent Gamedev truly capable of realizing the games you’ve always wanted to make.

Nathan

Founder and teacher at GDQuest
  • Starter Kit
  • Learn Gamedev from Zero
Check out GDSchool

You're welcome in our little community

Get help from peers and pros on GDQuest's Discord server!

20,000 membersJoin Server

Contribute to GDQuest's Free Library

There are multiple ways you can join our effort to create free and open source gamedev resources that are accessible to everyone!