> For the complete documentation index, see [llms.txt](https://docs.furkangulsen.com/golang-dokumani/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.furkangulsen.com/golang-dokumani/if-else.md).

# if/else

`if` ve `else` ifadeleri, Go programlama dilinde, belirli koşulların doğru veya yanlış olması durumunda farklı kod bloklarının çalışmasını sağlar.

```go
if x > 0 {
    fmt.Println("Positive number")
} else if x < 0 {
    fmt.Println("Negative number")
} else {
    fmt.Println("Zero")
}
```

Bu örnekte, `if` ifadesi, `x` değişkeninin `0` dan büyük olması durumunda "Positive number" metnini yazdıracaktır. Eğer `x` değişkeni `0` dan büyük değilse, `else if` ifadesi kontrol edilecek ve `x` değişkeninin `0` dan küçük olması durumunda "Negative number" metnini yazdıracaktır. Eğer `x` değişkeni `0` dan büyük veya küçük değilse, `else` bloğu çalışacak ve "Zero" metnini yazdıracaktır.

`if` ve `else` ifadeleri, karmaşık koşulları kontrol etmek için de kullanılabilir.

```go
if x > 10 && x < 20 {
    fmt.Println("x is between 10 and 20")
} else if x > 20 && x < 30 {
    fmt.Println("x is between 20 and 30")
} else {
    fmt.Println("x is not between 10 and 30")
}
```

Bu örnekte, `if` ifadesi, `x` değişkeninin `10` ve `20` arasında olması durumunda "x is between 10 and 20" metnini yazdıracaktır. Eğer `x` değişkeni `10` ve `20` arasında değilse, `else if` ifadesi kontrol edilecek ve `x` değişkeninin `20` ve `30` arasında olması durumunda "x is between 20 and 30" metnini yazdıracaktır. Eğer `x` değişkeni `10` ve `30` arasında değilse, `else` bloğu çalışacak ve "x is not between 10 and 30" metnini yazdıracaktır.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://docs.furkangulsen.com/golang-dokumani/if-else.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.
