Mathf.Max Manual     Reference     Scripting  
Scripting > Runtime Classes > Mathf
Mathf.Max

static function Max (a : float, b : float) : float

static function Max (params values : float[]) : float

Description

Returns largest of two or more values.

JavaScripts
// prints 2.4
print(Mathf.Max(1.2, 2.4));

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
void Awake() {
print(Mathf.Max(1.2F, 2.4F));
}
}

import UnityEngine
import System.Collections

class example(MonoBehaviour):

def Awake():
print(Mathf.Max(1.2F, 2.4F))

static function Max (a : int, b : int) : int

static function Max (params values : int[]) : int

Description

Returns the largest of two or more values.

JavaScripts
// prints 2
print(Mathf.Max(1, 2));

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
void Awake() {
print(Mathf.Max(1, 2));
}
}

import UnityEngine
import System.Collections

class example(MonoBehaviour):

def Awake():
print(Mathf.Max(1, 2))