1
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?

java note

Last updated at Posted at 2024-02-18

ラベルを用いて多重ループを自由に移動 or 抜ける

labalName: for(int i = 0; i < 10; i++) {
    for(int j = 0; j < 10; j++) {
        if (何らかの条件) {
            break labalName; // このbreak文で外側のループまで一気に抜ける
        }
    }
}

この時continue文を用いてラベルを指定すると指定したラベルの初めにジャンプして次の繰り返しを行う。


1
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
1
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?