> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/ios/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/ios/swift/op/ternary.md).

# 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 %}
