def setup
background(220)
numArray = [2, 1, 5, 4, 9, 8]
fill(0)
noStroke
text('Array Elements', 0, 10)
# Draw all numbers in the array
spacing = 15;
elemsY = 25;
(0...numArray.length).each do |i|
text(numArray[i], i * spacing, elemsY)
end
x = 33
y = 80
# Draw the Maximum value in the array.
textSize(32);
text(max(numArray), x, y);
end
一連の数値の最大値を求めます。
| 引数名 | 内容 | 備考 | オプション | デフォルト値 |
|---|---|---|---|---|
| n0 | 比較対象の数値 | |||
| n1 | 比較対象の数値 | |||
| nums | 数値の配列 |
最大値