Imperative programming
2025/12/27
- Type
- Learning Resource
- Format
- Glossary Article
- Version
- General
- Subject Tags
- Created
- Updated
- 2026/02/16
- 2025/12/27
Imperative programming is a way of writing code in which you write your program as a series of precise instructions or commands for the computer to follow. It is like the steps to execute a recipe in cooking: "Pour the eggs. Add the sugar. Mix well."
For example, when you write code that changes the position or rotation properties of a node in Godot, we say that the code is imperative:
position += velocity * delta
rotation = velocity.angle()This kind of code is the closest in principle to how a computer works, although when using a scripting language, your code looks much more straightforward than the actual instructions the computer follows.
Languages like GDScript and C#, the two scripting languages of Godot, use the imperative way of programming, also called the imperative paradigm, and mix it with the object-oriented paradigm.
Imperative programming is often put in contrast with declarative programming, which focuses on describing what the result of the code should be rather than giving individual instructions.
Imperative coding writes out all the steps; declarative coding describes the result you want. Imperative programming describes how to obtain a result, while declarative programming describes what the result should be.
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.
Get help from peers and pros on GDQuest's Discord server!
20,000 membersJoin ServerThere are multiple ways you can join our effort to create free and open source gamedev resources that are accessible to everyone!
Sponsor this library by learning gamedev with us onGDSchool
Learn MoreImprove and build on assets or suggest edits onGithub
Contributeshare this page and talk about GDQUest onRedditYoutubeTwitter…