Processing (BETA) version 135+ のリファレンスです。 旧バージョン使用者はソフトウェア内のリファレンスを参照してください。
この文書は Processing のAPIリファレンスを日本語に訳したものです。 最新の内容は 英語版 で確認して下さい。


Name

Array

Examples
int[] numbers = new int[3];
numbers[0] = 90;
numbers[1] = 150;
numbers[2] = 30;
int a = numbers[0] + numbers[1]; // Sets variable a to 240
int b = numbers[1] + numbers[2]; // Sets variable b to 180

int[] numbers = { 90, 150, 30 };
int a = numbers[0] + numbers[1]; // Sets variable a to 240
int b = numbers[1] + numbers[2]; // Sets variable b to 180

int degrees = 360;
float[] cos_vals = new float[degrees];
for(int i=0; i < degrees; i++) {
  cos_vals[i] = cos(TWO_PI/degrees * i);
}
Description 配列はデータのリストです。 どんなデータ型でも配列は持つことができます。 配列内のデータは、配列の位置を表すインデックスで特定されます。 配列の最初の要素は[0]です。 2番目の要素は[1]です。 配列はオブジェクトと同様にnewキーワードを指定して作成します。 全ての配列は、配列の全要素数を整数値で示す変数lengthを持ちます。
Syntax
datatype[] varvar[element] = valuevar.length
Parameters
datatype any primitive or compound datatype, including user defined classes
var any valid variable name
element int: must not exceed the length of the array - 1
value data to assign to the array element, must be the same datatype as the array
Usage Web & Application
Updated on September 23, 2006 05:40:19pm PDT

Creative Commons License

この文書の原文はクリエイティブ・コモンズ(Creative Commons)Attribution-Noncommercial-Share Alike(表示・非営利・継承) ライセンスで公開されています。 このライセンスは同一の許諾条件の下で原作者のクレジットを表示し、また作品を営利目的で利用しなければ、作品に対して複製、頒布、展示、実演、二次的著作物の作成が行えることを示します。

© 2007 Processing.org