Imperative programming

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

Imperative programming

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.

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!