> For the complete documentation index, see [llms.txt](https://hanuce.gitbook.io/javascript-egitimi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hanuce.gitbook.io/javascript-egitimi/operatorler/kosullu-ternary-operator.md).

# Koşullu (Ternary) Operatör

**`?`** sembolü ile kullanılır. Standart operatörlerdeki **`true`** veya **`false`** çıktısını kontrol eder. Koşuldan soran **`?`** sembolü getirilir ve **`true`** olması durumunda atanacak değer yazılır ardından : sembolü konur ve **`false`** olduğu durumda atanacak değer yazılır.  Örnek.

{% code lineNumbers="true" %}

```javascript
let ortalama = 45;
alert(ortalama >= 45 ? 'Geçti' : 'Kaldı');
```

{% endcode %}

Birkaç tane koşullu operatör birbirine bağlanabilir. Örnek.

{% code lineNumbers="true" %}

```javascript
let ortalama = 70;
let durum = ortalama < 0 ? 'Değerlendirme Dışı'
          : ortalama < 45 ? 'Zayıf'
          : ortalama < 55 ? 'Geçer'
          : ortalama < 70 ? 'Orta'
          : ortalama < 85 ? 'İyi'
          : ortalama <= 100 ? 'Pekiyi'
          : 'Değerlendirme Dışı';
alert(durum);
```

{% endcode %}

Şeklinde de kullanılabilir. Kodun okunurluğunu azalttığı için kullanımı önerilmez.
