0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

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

Last updated at Posted at 2020-05-24

このページでは[「P5.js 日本語リファレンス」] (https://qiita.com/bit0101/items/91818244dc26c767a0fe) の createStringDict関数を説明します。

createStringDict()

説明文

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

構文

createStringDict(key, value)

createStringDict(object)

パラメタ

  • key
    String:キー名

  • value
    String:値

  • object
    Object:オブジェクト

戻り値

p5.StringDict:

function setup() {

  // キー "val" に "abcde" を設定して、p5.StringrDict のオブジェクトを生成
  let myDict = createStringDict("val", "abcde");

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

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

実行結果

著作権

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?