Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(筆記)區分 Methods and Functions #127

Open
gracekrcx opened this issue May 15, 2022 · 1 comment
Open

(筆記)區分 Methods and Functions #127

gracekrcx opened this issue May 15, 2022 · 1 comment

Comments

@gracekrcx
Copy link
Owner

gracekrcx commented May 15, 2022

method

The method is a function associated with an instance of class (object).
The method is just a function declared inside a type (class/struct/enum)
(上句的 type 是指 Swift 的 type)
結論:以 js 來說,在 class 內宣告的 function,稱為 method
呼叫方式:
js 中的 method ,比較好聯想的是 js Built-In Methods,
例如:string 就會有 toLowerCase() 的 method, array 就會有 filter(), 物件導向的思考

function

A function is a piece of code that is called by name.
結論:以 js 來說,宣告在 class 外的 functions 就是 function
呼叫方式:在 call function 時可以帶入需要的 arguments

reference

GiveMePasS's Android惡補筆記
ios_dev_alb
Methods and Functions

@gracekrcx
Copy link
Owner Author

Concepts of functional programming - What is a pure function?

之前完全沒有接觸的點
在 what is functional programming 的最後一點
『No iteration. Operations are done by recursion』

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant