break គឺជា statement ដែលជាបញ្ជាតំរូវអោយបញ្ឈប់ជាបន្ទាន់នូវការអនុវត្ត block នៃ statement នៅក្នុង statement for ឬ statement while ។
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | resume = { 'name' : 'Kosal' , 'last name' : 'Keo' , 'age' : 35 , 'address' : 'Cambodia' } b = 0 for ele in resume: b + = 1 if b = = 3 : break print ( 'The value attached to the key' , ele, 'is' , resume[ele]) while True : b + = 1 print ( 'b is the number' , b) if b = = 10 : break |
The value attached to the key name is Kosal
The value attached to the key last name is Keo
b is the number 4
b is the number 5
b is the number 6
b is the number 7
b is the number 8
b is the number 9
b is the number 10
The value attached to the key last name is Keo
b is the number 4
b is the number 5
b is the number 6
b is the number 7
b is the number 8
b is the number 9
b is the number 10