mình có 2 vòng for thế này:
for(int i = 0 ; i < 100 ; i++) { for(int j = 0 ; j < 100 : j++) { if(j == 50) { // mình muốn thoát cả 2 vòng lặp ở đây } } }
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Bạn thử dùng
Bạn thử search từ khóa “Labels break in Go”
Anh thử dùng goto xem được không ak
Bạn có thể chuyển 2 vòng for đó thành 1 func, sau đó return chỗ bạn muốn break là được. Mình nghĩ đó là một trong những cách nên nhất.