当前位置:网站首页>Pass anonymous function to simplification principle
Pass anonymous function to simplification principle
2022-06-30 09:26:00 【Orangejuicer】
Anonymous functions
** explain :** Functions without names are anonymous functions .
(x:Int) => { The body of the function }
x: Represents the input parameter type ;Int: Represents the input parameter type ; The body of the function : Represents specific code logic
Pass anonymous functions to the simplicity principle :
The type of parameter can be omitted , Will automatically deduce according to the formal parameters
After type omission , It turns out that there's only one parameter , The parentheses can be omitted ;
Other situations : There are no parameters and parameters beyond 1 You can never omit the parentheses .
If anonymous function has only one line , The braces can also be omitted
If the parameter appears only once , Then the parameters are omitted and the following parameters can be used _ Instead of
边栏推荐
- Opencv learning notes -day10 logical operation of image pixels (usage of rectangle function and rect function and bit related operation in openCV)
- Generate directory in markdown
- Deeply understand the working principle of kotlin collaboration suspend (beginners can also understand it)
- float
- Advanced technology management -- how managers design and build echelons
- Interviewer: do you understand the principle of recyclerview layout animation?
- Challenge transform() 2D
- Treatment process record of Union Medical College Hospital (Dongdan hospital area)
- JVM tuning related commands and explanations
- Get to know handler again
猜你喜欢

ES6 learning path (III) deconstruction assignment

5. Messager framework and imessager interface

Interviewer: do you understand the principle of recyclerview layout animation?

Talk about the kotlin cooperation process and the difference between job and supervisorjob

Set, map and modularity

Opencv learning notes-day14 drawing of image geometry (rect class rotatedrect class, rectangle drawing rectangle circle drawing circular function line drawing line function ellipse drawing elliptic fu

Handwriting sorter component

Talk about how the kotlin collaboration process establishes structured concurrency

ES6 learning path (II) let & const

What kind of experience is it to develop a "grandson" who will call himself "Grandpa"?
随机推荐
Opencv learning notes -day 12 (ROI region extraction and inrange() function operation)
Small program learning path 1 - getting to know small programs
What kind of experience is it to develop a "grandson" who will call himself "Grandpa"?
Opencv learning notes-day14 drawing of image geometry (rect class rotatedrect class, rectangle drawing rectangle circle drawing circular function line drawing line function ellipse drawing elliptic fu
Set, map and modularity
Use V-IF with V-for
Opencv learning notes -day1 (image reading display imread, imshow, namedwindow)
Challenge transform() 2D
Tclistener server and tcpclient client
JVM tuning related commands and explanations
Unsupportedclassversionerror is reported when starting jar package. How to repair it
Talk about the kotlin cooperation process and the difference between job and supervisorjob
Research on lg1403 divisor
Implementing custom drawer component in quick application
Coredata acquisition in swift sorting, ascending, descending
Pit encountered by fastjason
Express の post request
Comparison of two ways for C to access SQL Server database (SqlDataReader vs SqlDataAdapter)
ES6 learning road 5 symbol
Based on svelte3 X desktop UI component library svelte UI