我认为这是一个非常易读的代码块,
for i in range(100):
continue if i % 2 == 0
Run Code Online (Sandbox Code Playgroud)
但它在语法上并不正确.我们可以在Python中做其他好事,比如
for i in things:
total += 3 if i % 2 == 0 else 1
Run Code Online (Sandbox Code Playgroud)
或者可能,
return a if b > a else c
Run Code Online (Sandbox Code Playgroud)
为什么我们不能continue if发表声明?