如果不是除正常以外的其他方式退出循环,那么else语句就会被执行。

也就是循环体内没有break语句、return语句、和其他异常语句的执行。

for   else

>>> for i in range(0,10):
             if  i > 10:
                   break;
       else:

print "hello world";

输出:hello world
>>> for i in range(0,10):
             if  i > 5:
                  break;
        else:
              print "hello world";
没有输出
-------------------
即在for 循环中,如果没有从任何一个break中退出,则会执行和for对应的else
只要从break中退出了,则else部分不执行。

最新文章

  1. 控件 UI: VisualState, VisualStateManager, 控件的默认 UI
  2. elasticsearch客户端连接选择
  3. CCF真题之窗口
  4. 会话标识未更新(AppScan扫描结果)
  5. Swiper之初识
  6. OBIEE 11g:Error:nQSError 36010 Server version 318 cannot read the newer version of the repository
  7. WebView的应用 持续积累
  8. Static Final用法
  9. CentOS 添加/绑定 IP
  10. u Calculate e
  11. Ch.3 Aray and String
  12. Mybatis框架的搭建和基本使用方法
  13. spring security 4 filter 顺序及作用
  14. Go学习——go+channel实战(转)
  15. java.lang.ClassCastException: net.sf.json.JSONNull cannot be cast to net.sf.json.JSONObject的解决方法
  16. 小甲鱼零基础python课后题 P21 020函数:内嵌函数和闭包函数
  17. C#基本方法(瞎写写)
  18. 部署与管理ZooKeeper(版本有点老,3.4.3)
  19. linux查询公网ip
  20. Makefile introduction (very old presentation)

热门文章

  1. Kettle基本概念学习
  2. JS——页面倒计时跳转
  3. js针对数组的操作
  4. [转]python 装饰器
  5. SpringBoot2.X自定义拦截器实战及新旧配置对比(核心知识)
  6. Struts S2-052漏洞利用
  7. 如何用MoveIt快速搭建机器人运动规划平台?
  8. 使用密钥认证机制远程登录Linux
  9. VxWorks软件开发项目实例完全解析1-VxWorks简介
  10. 用nodejs搭建BS环境