LoginSignup
0
0

More than 3 years have passed since last update.

P5.js 日本語リファレンス(createNumberDict)

Last updated at Posted at 2020-05-24

このページでは「P5.js 日本語リファレンス」 のcreateNumberDict 関数を説明します。

createNumberDict()

説明文

指定したキーと値のペアまたはオブジェクトを使用して p5.NumberDict の新しいオブジェクトを作成します。

構文

createNumberDict(key, value)

createNumberDict(object)

パラメタ

  • key

    Number:キー名

  • value

    Number:値

  • object

    Object:オブジェクト

戻り値

p5.NumberDict:

function setup() {

  // キー 100 に 42 を設定して、p5.NumberDict のオブジェクトを生成
  let myDict = createNumberDict(100, 42);

  // .hashkey() を使用してキー 100 の存在を確認します
  // (存在するとき true をコンソールに表示)
  // なお、.hashkey() は p5.TypedDict で定義されています
  print(myDict.hasKey(100));

  // キー 100 の値をコンソールに表示
  // .get() は p5.TypedDict で定義されています
  print(myDict.get(100));
}

実行結果

著作権

p5.js was created by Lauren McCarthy and is developed by a community of collaborators, with support from the Processing Foundation and NYU ITP. Identity and graphic design by Jerel Johnson.

ライセンス

Creative Commons(CC BY-NC-SA 4.0) に従います。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0