#!\usr\bin\env\python
#-*- coding:utf -8 -*9
#定义函数
def func1():
"书写函数声明"
print('in the func1')
return 0
#定义过程
def func2():
print('in the func2')
#调用函数的方法
x=func1()
y=func2()
#检验上述函数是否带函数返回值由下面两条语句
print('from func1 return is %s ' %x)
print('from func2 return is %s ' %x)
打印输出结果:
from func1 return is o
from func2 return is None
总结:
#函数在执行过程中只要遇到return语句,就会停止执行并返回结果,so 也可以理解为 return 语句代表着函数的结束,如果未在函数中指定return,那这个函数的返回值为None
#定义函数和定义过程之间的区别在于:定义函数需要带return 返回值,定义过程则不需要带返回值
#本人已知的编程方法共有三种:1.面向对象,2.面向过程,3.函数式编程
#面向过程的程序设计方法:实际上就是定义无数个def过程,把无数个def进行拼接成一个整体的程序。