# takeUnless

```kotlin
//(T) -> it 으로 접근가능.
inline fun <T> T.takeUnless(predicate: (T) -> Boolean)
: T? = if (!predicate(this)) this else null

//takeIf 와 반대의 개념.
```

```kotlin
val ari = person.takeUnless { it.name == "ari" }
println(ari) // Person(name = gold, age = 18)

val gold = person.takeUnless { it.name == "gold" }
println(gold) // null

val default = person.takeUnless { it.name = "ari" } ?: Person("ari", 24)
println(default) // Person(name=gold, age=18)
```


---

# 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://gold.gitbook.io/kotlin/kotlin-standard/takeunless.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.
