daniellansun commented on PR #2169: URL: https://github.com/apache/groovy/pull/2169#issuecomment-2764351669
How about `for (int index, var item : items)`? For example: ```groovy // ① traverse a list List<String> names = Arrays.asList("Alice", "Bob", "Charlie"); for (int i, String name : names) { System.out.println(i + ": " + name.toUpperCase()); } // ② traverse a matrix int[][] matrix = {{1,2}, {3,4}}; for (int row, int[] cols : matrix) { for (int col, int val : cols) { System.out.printf("[%d,%d]=%d\n", row, col, val); } } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@groovy.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org