Expressions
2025/12/27
- Type
- Learning Resource
- Format
- Glossary Article
- Version
- General
- Subject Tags
- Created
- Updated
- 2026/02/16
- 2025/12/27
In computer programming, an expression is any combination of special characters, variables, and function calls that is a value or produces a value.
Here are a couple of examples of expressions:
15, which is the value 15."Hello World", which is the value "Hello World".3 + 2, which produces the value 5.3 > 2, which produces the value true, because 3 is larger than 2.health + 1, which produces the sum of the variable health and 1.The code var health = 0 is not an expression because it does not produce a value: it creates a variable named health and assigns the value 0 to it.
You can combine expressions to form more complex expressions. For example, the expression 3 + 4 is a combination of the expressions 3 and 4 using the + operator.
In this code listing, each line contains an expression. The code uses values directly or calls functions that return values, but of course, it also works if you use variables instead of values.
3
3 + 4 * 5
"Hello, " + "world!"
true and false
randf_range(10.0, 100.0)It's important to note that not every piece of code produces a value. For instance, defining a function or a variable is not an expression because it does not produce a value.
When you see an error like "expected expression" while coding, it means that the computer expects you to write a piece of code that produces a value but you wrote something that does not.
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…