Continue Statement

continue គឺ​ជា​ statement ដែល​ជា​បញ្ជា​តំរូវ​អោយ​អនុវត្ត​សារឡើងវិញ​ជា​បន្ទាន់​នូវ block នៃ statement នៅ​ក្នុង statement while ឬ statement for ។

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
resume = {'name':'Kosal', 'last name':'Keo', 'age':35, 'address':'Cambodia'}
b = 0
for ele in resume:
    b += 1
    if b == 4:
        continue
 
    print('The value attached to the key', ele, 'is', resume[ele])
 
while b < 10:
    b += 1
    if b == 7:
        continue
 
    print('b is the number', b)
The value attached to the key name is Kosal
The value attached to the key last name is Keo
The value attached to the key age is 35
b is the number 5
b is the number 6
b is the number 8
b is the number 9
b is the number 10