Name

max — Return the larger of two numbers

Usage

Lang.max(num1, num2)

num1 : Number

num2 : Number

Description

Returns the larger of num1 and num2. If they are equal, returns num1. The value returned has the same type as the operand.

If either num1 or num2 can’t be converted to a number, returns invalid.

Examples

Lang.max(-2, 3.4)

returns floating-point 3.4

Lang.max(17, 23)

returns integer 23

Lang.max(-3, -3.0)

returns integer -3

Lang.max(-5, false)

returns Boolean false

Lang.max("6", 6)

returns string "6"

Lang.max("six", 6)

returns invalid

Get Learning WML, and WMLScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.