何代杰
Python-Note-4-Continue-statements
2017-4-11 01:59
阅读:2104

Continue statements

If the continue function is executed, go back to the start of the clause of the while loop.


Example:

while True:

   print('please type your name')

   name=input()

   if name!='Jack':

       continue

   print('type your password')

   password=input()

   if password=='password':

       break

print('Welcome to Python'+name)


Nb: if the username is Jack, type and match the password. Otherwise, go back to the beginning of the while loop.

转载本文请联系原作者获取授权,同时请注明本文来自何代杰科学网博客。

链接地址:https://m.sciencenet.cn/blog-850613-1048044.html?mobile=1

收藏

分享到:

当前推荐数:0
推荐到博客首页
网友评论0 条评论
确定删除指定的回复吗?
确定删除本博文吗?