LoginSignup
0
0

More than 3 years have passed since last update.

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

Last updated at Posted at 2020-08-23

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

int()

説明文

ブール値、文字列、または浮動小数点数をその整数表現に変換します。値の配列が渡されると、同じ長さのint配列が返されます。

構文

int(n, [radix])

int(ns)

パラメタ

  • n
    String | Boolean | Number:変換する値

  • radix
    Number:変換する基数(デフォルト:10)(オプション)

  • ns
    Array:変換する配列

戻り値

数値:値の整数表現

例1

print(int('10 ')); // 10
print(int(10.31)); // 10
print(int(-10)); // -10
print(int(true)); // 1
print(int(false)); // 0
print(int([false, true, '10 .3 ', 9.8])); // [0, 1, 10, 9]
print(int(Infinity)); //Infinity
print(int('-Infinity')); //-Infinity

著作権

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