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

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
主站蜘蛛池模板: 定西市| 高邮市| 龙泉市| 汝南县| 璧山县| 桂阳县| 固镇县| 定州市| 武乡县| 同心县| 钟山县| 新昌县| 乌审旗| 阳原县| 独山县| 临朐县| 海城市| 阜新市| 光山县| 读书| 铜川市| 周口市| 涿州市| 江西省| 阿图什市| 溆浦县| 类乌齐县| 柳河县| 松溪县| 高安市| 沁阳市| 和田市| 广平县| 山东省| 莎车县| 南皮县| 清苑县| 嘉兴市| 古交市| 黄陵县| 炉霍县|