![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-hukidashi-light-blue.png)
今回の記事の目的はProcessingの「switch
」を理解し、自分なりに使ってみること。
この記事を書いた人
![](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】switchについて
- switchは、特定の変数の値によって異なる処理をするためのもの
【Processing】switchの使い方【画像とコード】
![【Processing】switchの使い方【画像とコード】](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/11/processing-switch-statement-guide-variable-specific-actions1.png)
![【Processing】switchの使い方【画像とコード】](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/11/processing-switch-statement-guide-variable-specific-actions1.png)
int day = 3; // 曜日の番号を示す変数(1が月曜日、2が火曜日...)
switch (day) {
case 1:
println("今日は月曜日です。");
break;
case 2:
println("今日は火曜日です。");
break;
case 3:
println("今日は水曜日です。");
break;
// 他の曜日のケースを追加できます
default:
println("曜日が正しくありません。");
}
【Processing】switchを使ってみた感想
今の段階の僕では、作品をつくる中でどのように使うのかは具体的にイメージしにくい。
![](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)
それでは今日もレッツワクワクコーディング。