函数的介绍与使用
函数是就是把具有独立功能的代码块 组织为一个小模块,在需要的时候调用
函数包含两个步骤:
1 定义函数--------封装独立的功能
2 调用函数--------享受封装的成果
函数的格式:

函数的名称符合标识符的命名规则:
可以由字母、下划线和数字组成
不能以数字开头
不能以与关键词重名
函数的调用


匿名函数
注意lambda表达式只可以包含一个表达式,不允许包含其他复杂的语句,但是在表示中可以调用其他函数并支持默认参数和关键参数,该表示的计算结果相当于函数返回值。


网友评论