Functions and Methods
函数(Functions)是用来完成特地任务的独立的代码块;方法(Methods)是与某些特定类型相关联的函数。所以 Swift 中都用的 func 关键词。 结构体和枚举能够定义方法是 Swift 与 C/Objective-C 的主要区别之一。
Functions are self-contained chunks of code that perform a specific task.
Methods are functions that are associated with a particular type: classes, structures, and enumerations.