---
title: "coerceIn"
description: "Ensures that this value lies in the specified range [minimumValue]..[maximumValue]."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
inline fun Dp.coerceIn(minimumValue: Dp, maximumValue: Dp): Dp
```


Ensures that this value lies in the specified range `minimumValue`..`maximumValue`.

#### Returns

| | |
| --- | --- |
|  | this value if it's in the range, or `minimumValue` if this value is less than `minimumValue`, or `maximumValue` if this value is greater than `maximumValue`. |




