![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-hukidashi-light-blue.png)
今回の記事の目的はProcessingの「Table.getInt()
」を理解し、自分なりに使ってみること。
この記事を書いた人
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-user-profile-illustrationi-light-blue.png)
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-user-profile-illustrationi-light-blue.png)
- クリエイティブコーディングで制作した作品と、上達のためにやったこと・学習過程を発信
- コンセプトは「クリエイティブコーディング1万時間の歩き方」
- 2024年にProcessingの構文のアウトプットを終え、2025年から作品制作開始(クリエイティブコーディングで作成した作品集)
目次
【Processing】Table.getInt()について
Table.getInt()について
Table.getInt()
の英語の意味:テーブルから整数を取り出す(”Get an integer from the table”)- integerは整数
Table.getInt()
は、表の中から特定の数字を取り出すための命令- 【注意点】指定した場所に数字がないときは、エラーになるかもしれないので注意が必要
【Processing】Table.getInt()の使い方【画像とコード】
![【Processing】Table.getInt()の使い方【画像とコード】](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/11/processing-table-getint-extract-specific-numbers1.png)
![【Processing】Table.getInt()の使い方【画像とコード】](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/11/processing-table-getint-extract-specific-numbers1.png)
Table table; // テーブルを宣言
void setup() {
table = new Table(); // テーブルのインスタンスを作成
table.addColumn("Name"); // 「Name」という名前の列を追加
table.addColumn("Score"); // 「Score」という名前の列を追加
TableRow newRow = table.addRow(); // 新しい行を追加
newRow.setString("Name", "ポチ"); // 名前列に「ポチ」を設定
newRow.setInt("Score", 85); // スコア列に85を設定
newRow = table.addRow(); // 別の新しい行を追加
newRow.setString("Name", "タマ"); // 名前列に「タマ」を設定
newRow.setInt("Score", 92); // スコア列に92を設定
int pochiScore = table.getInt(0, 1); // 最初の行(ポチ)のスコアを取得
println("ポチのスコアは: " + pochiScore); // 取得したスコアを表示
}
【Processing】Table.getInt()はどう役に立つのか
データを扱うプログラムで、特定の情報を見つけるのに役立ちます。例えば、表の中の生徒の点数を調べたりします。
【Processing】Table.getInt()を使ってみた感想
表を使った表現をするときに便利。
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-hukidashi-light-blue.png)
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-hukidashi-light-blue.png)
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-hukidashi-light-blue.png)
それでは今日もレッツワクワクコーディング。