当前位置:网站首页>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
边栏推荐
- Esp32 things (VIII): music playing function of function development
- Design specification for smart speakers v1.0
- asdsadadsad
- Talk about how the kotlin collaboration process establishes structured concurrency
- QT downloading files through URL
- Rew acoustic test (V): equipment required for test
- Set, map and modularity
- Opencv learning notes-day6-7 (scroll bar operation demonstration is used to adjust image brightness and contrast, and createtrackbar() creates a scroll bar function)
- Net framework system requirements
- Mmdet line by line deltaxywhbboxcoder
猜你喜欢
Opencv learning notes -day10 logical operation of image pixels (usage of rectangle function and rect function and bit related operation in openCV)
Rew acoustic test (VI): signal and measurement
Opencv learning notes -day2 (implemented by the color space conversion function cvtcolar(), and imwrite image saving function imwrite())
Resnet50+fpn for mmdet line by line code interpretation
Explanation on the use of password profiteering cracking tool Hydra
Talk about the kotlin cooperation process and the difference between job and supervisorjob
What kind of experience is it to develop a "grandson" who will call himself "Grandpa"?
Esp32 things (II): sharpening the knife without mistaking firewood - make preparations before project development
Interpretation of orientedrcnn papers
Challenge transform() 2D
随机推荐
Wechat development tool (applet)
Mmdet line by line code interpretation of positive and negative sample sampler
Implementing custom drawer component in quick application
Net framework system requirements
RPC understanding
Understanding of MVVM and MVC
Guilin robust medical acquired 100% equity of Guilin Latex to fill the blank of latex product line
What are the SQL add / delete / modify queries?
[wechat applet] realize applet pull-down refresh and pull-up loading
Comparison of two ways for C to access SQL Server database (SqlDataReader vs SqlDataAdapter)
[shutter] solve failed assertion: line 5142 POS 12: '_ debugLocked‘: is not true.
2020-11-02
Treatment process record of Union Medical College Hospital (Dongdan hospital area)
Opencv learning notes -day 11 (split() channel separation function and merge() channel merge function)
How do I start? (continuously updating)
Interpretation of orientedrcnn papers
Interpretation of source code demand:a rotation equivariant detector for aerial object detection
Deep Learning with Pytorch-Train A Classifier
Opencv learning notes-day6-7 (scroll bar operation demonstration is used to adjust image brightness and contrast, and createtrackbar() creates a scroll bar function)
Rew acoustic test (I): microphone calibration