# ternary conditional operator (a ? b : c)

[Swift](/ios/swift.md) ⟩ [operator](/ios/swift/op.md) ⟩ ternary

{% hint style="success" %}
A special shorthand way to write a <mark style="color:yellow;">conditional statement</mark>, also called <mark style="color:purple;">ternay conditional operator</mark>, <mark style="color:purple;">ternary operator</mark>, <mark style="color:purple;">conditional operator</mark>.&#x20;

```swift
// ternary conditional operator
condition ? trueValue : falseValue
```

{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lochiwei.gitbook.io/ios/swift/op/ternary.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
