---
title: Expressions
framework: appstoreconnectapi
role: collectionGroup
path: appstoreconnectapi/expressions
---

# Expressions

Write expressions that query the match requests in a queue to find the best players for a match.

## Overview

Overview An expression is a JMESPath formatted string with additional matchmaking rule functions. Game Center uses the expression to query a collection of match requests represented as JSON. The expression needs to evaluate to either a Boolean or number value according to the rule type. To create a matchmaking rule in Game Center, you pass an expression to the Create a Rule endpoint. Set the expression and type fields of the GameCenterMatchmakingRuleCreateRequest.Data.Attributes object that you pass in the request. For example, if players can only join matches that run the same version of your game, add a compatible rule that compares the app versions. If you set the rule’s type field to COMPATIBLE, the requests array in the JSON input to the expression contains two match requests to compare. In the expression, use the areCompatibleAppVersions() function that returns true if the app versions are compatible. areCompatibleAppVersions(requests[0], requests[1]) You can improve the game experience by prioritizing matches between players who are geographically close, resulting in lower latency when sending messages between devices. If you set the rule’s type field to DISTANCE, the requests array in the expression contains two match requests to compare. In the expression, use the geoLatency() function that returns a range between 0.0 and 1.0, where 0.0 is in the local area: geoLatency(requests[0], requests[1]) The JSON input to an expression contains the following arrays, that you can use in expressions, depending on the rule type:  |   |   |   |

## Topics

### Comparison functions

- [Comparing app versions](appstoreconnectapi/comparing-app-versions.md)

### Distance functions

- [Getting geographic distance](appstoreconnectapi/getting-geographic-distance.md)

### Match functions

- [Getting value based on age](appstoreconnectapi/getting-value-based-on-age.md)
- [Getting value based on age using an array](appstoreconnectapi/getting-value-based-on-age-using-an-array.md)

### Team functions

- [Keeping invited players on the same team](appstoreconnectapi/keeping-invited-players-on-the-same-team.md)

### Boolean functions

- [Evaluating a Boolean value](appstoreconnectapi/evaluating-a-boolean-value.md)

### Numeric functions

- [Dividing numbers](appstoreconnectapi/dividing-numbers.md)
- [Subtracting numbers](appstoreconnectapi/subtracting-numbers.md)

### Array functions

- [Converting arrays to sets](appstoreconnectapi/converting-arrays-to-sets.md)
- [Computing numeric differences](appstoreconnectapi/computing-numeric-differences.md)
- [Intersecting sets](appstoreconnectapi/intersecting-sets.md)

### Objects

- [Request](appstoreconnectapi/request.md)
- [Player](appstoreconnectapi/player.md)
- [Team](appstoreconnectapi/team.md)

## See Also

### Matchmaking rules

- [Rules](appstoreconnectapi/rules.md)
- [Rule sets](appstoreconnectapi/rule-sets.md)
- [Queues](appstoreconnectapi/queues.md)
- [Teams](appstoreconnectapi/teams.md)
- [Testing](appstoreconnectapi/testing.md)
- [Metrics](appstoreconnectapi/metrics.md)
