# Abs

> Returns the absolute value of f.

## Definition

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

## Abs(float)

Returns the absolute value of f.

```csharp
public static float Abs(float f)
```

### 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 10
        Debug.Log(Mathf.Abs(-10.0f));
        // Prints 0
        Debug.Log(Mathf.Abs(0.0f));
        // Prints 10
        Debug.Log(Mathf.Abs(10.0f));
    }
}
```

## Abs(int)

Returns the absolute value of `value`.

```csharp
public static int Abs(int value)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Integer number whose absolute value will be returned.

### Returns

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

### Remarks

For an integer number `value`, its absolute value is defined as its non-negative value without regard to its sign.

Additional Resources: [Mathf.Sign](/engine/6000.0/script-reference/unityengine/mathf/sign.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{
    void Start()
    {
        // Prints 10
        Debug.Log(Mathf.Abs(-10));
        // Prints 0
        Debug.Log(Mathf.Abs(0));
        // Prints 10
        Debug.Log(Mathf.Abs(10));
    }
}
```
