官术网_书友最值得收藏!

The return statement

The return statement is used to exit a function. Refer to the following syntax:

return [expression_list]

This statement may contain an expression where a value has to be returned. If there is no expression, then the function will return a None object, as shown in the following example:

def return_value(a):
if a >= 0:
return a
else:
return -a
print(return_value(2))
print(return_value(-4))

Output:
2
4
主站蜘蛛池模板: 衡阳市| 伊宁市| 石林| 宁远县| 格尔木市| 宕昌县| 永昌县| 高邮市| 库尔勒市| 巨野县| 浠水县| 贵南县| 博湖县| 巫溪县| 昌邑市| 延吉市| 海城市| 碌曲县| 义马市| 北辰区| 申扎县| 洞头县| 正阳县| 栾城县| 万宁市| 英吉沙县| 缙云县| 阳山县| 安塞县| 闻喜县| 新乡县| 南乐县| 寻乌县| 盐源县| 乌兰县| 宝兴县| 古交市| 稻城县| 南雄市| 香港 | 大邑县|