Method

# Max

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Returns the largest value passed to it.

## Usage

``` xojo
result = Max(value1, value2,... valueN)
```

| Part   | Type                             | Description                                                                                                                                         |
|--------|----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| result | `Double</api/data_types/double>` | The maximum value of *value1* to *valueN*.                                                                                                          |
| value1 | `Double</api/data_types/double>` | The first number for comparison.                                                                                                                    |
| value2 | `Double</api/data_types/double>` | The second number for comparison.                                                                                                                   |
| valueN | `Double</api/data_types/double>` | Optional: <span class="title-ref">Max</span> requires two parameters but optionally can take more than two. *N* is the number of parameters passed. |

## Notes

The <span class="title-ref">Max</span> function compares two or more numbers and returns the largest of the passed values.

## Sample code

This example uses the <span class="title-ref">Max</span> function to return the largest of the values passed

``` xojo
Var d As Double
d = Max(3.01, 4.05) ' returns 4.05
d = Max(3.012, 3.011, 1.56) ' returns 3.012
```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`Abs</api/math/abs>`, `Ceiling</api/math/ceiling>`, `Exp</api/math/exp>`, `Floor</api/math/floor>`, `Min</api/math/min>`, `Pow</api/math/pow>`, `Sqrt</api/math/sqrt>` functions.

</div>
