I look at the sample code and found it here
public static List<Word> detectAllWords(int[][] crossword, String... words) { List<Word> wordList = new ArrayList<>(); int[][] searchDirections = new int[][] { {0, 1}, {1, 1}, {1, 0}, {1, -1}, {0, -1}, {-1, -1}, {-1, 0}, {-1, 1}, }; for (String word : words) nextWord:{ for (int i = 0; i < crossword.length; i++) { for (int j = 0; j < crossword[i].length; j++) { if (word.charAt(0) == crossword[i][j]) for (int directions = 0; directions < searchDirections.length; directions++) { int tmp_i = i, tmp_j = j, wordPos = 1; while (wordPos < word.length()) { tmp_i += searchDirections[directions][0]; tmp_j += searchDirections[directions][1]; if (tmp_i < 0 || tmp_i >= crossword.length || tmp_j < 0 || tmp_j >= crossword[tmp_i].length) break; if (word.charAt(wordPos) != crossword[tmp_i][tmp_j]) break; else if (wordPos == word.length() - 1) { Word tWord = new Word(word); tWord.setStartPoint(j, i); tWord.setEndPoint(tmp_j, tmp_i); wordList.add(tWord); break nextWord; } wordPos++; } } } } } return wordList; } So the first time I see this condition
for (String word : words) nextWord:{ and then it's like that tied to the line below
break nextWord; Tell me how it works or where there is something to read?