LoginSignup
0
0

java basic

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文を用いてラベルを指定すると指定したラベルの初めにジャンプして次の繰り返しを行う。


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