首页 > 文档 > max() 最大值
2017
07-18

max() 最大值

名称:max()

 

例子:

int a = max(5, 9);            // Sets 'a' to 9
int b = max(-4, -12);         // Sets 'b' to -4
float c = max(12.3, 230.24);  // Sets 'c' to 230.24

int[] values = { 9, -4, 362, 21 };  // Create an array of ints
int d = max(values);                // Sets 'd' to 362

 

描述:

确定数字序列中的最大值,然后返回该值。 max()接受两个或三个float或int值作为参数,或任意长度的数组。

 

语法:

max(a, b)
max(a, b, c)
max(list)

 

参数:

a float, or int: first number to compare      用于比较的第一个值
b float, or int: second number to compare   用于比较的第二个值
c float, or int: third number to compare     用于比较的第三个值
list float[], or int[]: array of numbers to compare    用于比较的数组

 

返回:int or float

 

相关:

min()

 

 



最后编辑:
作者:Hewes
这个作者貌似有点懒,什么都没有留下。

max() 最大值》有 2 条评论

  1. Pingback 引用通告: min() 最小值 | Processing编程艺术

  2. Pingback 引用通告: constrain() 约束 | Processing编程艺术

留下一个回复

你的email不会被公开。