「Python」while文を使うサンプルコード
構文
def 関数名(引数)
サンプルコード
# coding: utf-8
#!/usr/bin/python3
def funccft(x):
while x < 10:
yield x
x += 2
res = funccft(5)
print(next(res))
print(next(res))
print(next(res))
実行結果
n>python test.py
5
7
9