“Python/gloss python while else”的版本间差异

来自菜鸟教程
跳转至:导航、​搜索
(Pywikibot 4.4.0.dev0)
 
(机器人:添加分类Python基础教程
 
第44行: 第44行:
  
 
<br />
 
<br />
 +
 +
[[分类:Python基础教程]]

2020年10月29日 (四) 08:48的最新版本

<languages />

其他Python

else陈述

随着 else 声明当条件不再成立时,我们可以运行一次代码块:

条件为假时,打印一条消息:

i = 1

while i < 6:

  print(i)

  i += 1
else:
  print("i is no longer less than 6")

休息时

虽然继续

虽然其他