# Min

> Returns the smallest of two or more values.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

## Min(float, float)

Returns the smallest of two or more values.

```csharp
public static float Min(float a, float b)
```

### Parameters

**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): **** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)):&#x20;

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [float](https://learn.microsoft.com/dotnet/api/system.single) |             |

### Examples

```csharp
using UnityEngine;

public class ScriptExample : MonoBehaviour
{
    void Start()
    {
        // Prints 0
        Debug.Log(Mathf.Min(0, Mathf.Infinity));
        // Prints -Infinity
        Debug.Log(Mathf.Min(0, -Mathf.Infinity));
        // Prints -Infinity
        Debug.Log(Mathf.Min(-Mathf.Infinity, Mathf.Infinity));
        // Prints -1
        Debug.Log(Mathf.Min(0, 1, 5, -1, 8, 10));
    }
}
```

## Min(float\[])

Returns the smallest of two or more values.

```csharp
public static float Min(params float[] values)
```

### Parameters

**** (\[float\[]]\(https\://learn.microsoft.com/dotnet/api/system.single)):&#x20;

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [float](https://learn.microsoft.com/dotnet/api/system.single) |             |

### Examples

```csharp
using UnityEngine;

public class ScriptExample : MonoBehaviour
{
    void Start()
    {
        // Prints 0
        Debug.Log(Mathf.Min(0, Mathf.Infinity));
        // Prints -Infinity
        Debug.Log(Mathf.Min(0, -Mathf.Infinity));
        // Prints -Infinity
        Debug.Log(Mathf.Min(-Mathf.Infinity, Mathf.Infinity));
        // Prints -1
        Debug.Log(Mathf.Min(0, 1, 5, -1, 8, 10));
    }
}
```

## Min(int, int)

Returns the smallest of two or more values.

```csharp
public static int Min(int a, int b)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): **** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)):&#x20;

### Returns

| Type                                                       | Description |
| ---------------------------------------------------------- | ----------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) |             |

### Examples

```csharp
using UnityEngine;

public class ScriptExample : MonoBehaviour
{
    void Start()
    {
        // prints 1
        Debug.Log(Mathf.Min(1, 2));
    }
}
```

## Min(int\[])

Returns the smallest of two or more values.

```csharp
public static int Min(params int[] values)
```

### Parameters

**** (\[int\[]]\(https\://learn.microsoft.com/dotnet/api/system.int32)):&#x20;

### Returns

| Type                                                       | Description |
| ---------------------------------------------------------- | ----------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) |             |

### Examples

```csharp
using UnityEngine;

public class ScriptExample : MonoBehaviour
{
    void Start()
    {
        // prints 1
        Debug.Log(Mathf.Min(1, 2));
    }
}
```
