<!--
{
  "documentType" : "article",
  "framework" : "AppStoreConnectAPI",
  "identifier" : "/documentation/AppStoreConnectAPI/evaluating-a-boolean-value",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "Evaluating a Boolean value"
}
-->

# Evaluating a Boolean value

Return given values for true and false results of a conditional.

## Discussion

Use the `if()` function in the expression of a matchmaking rule to return values depending on a Boolean conditional. For example, `if (true, `0.0`, `1.0`)` returns `0.0`, and `if (false, `0.0`, `1.0`)` returns `1.0`.

### Declaration

```swift
any if(boolean $condition, any $ifTrue, any $ifFalse)
```

### Parameters

-`condition`: An expression that evaluates to a Boolean value.
-`ifTrue`: The value to return if `condition` is `true`.
-`ifFalse`: The value to return if `condition` is `false`.

### Return value

Returns `ifTrue` if `condition` is `true`; otherwise, `ifFalse`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)