当前位置:网站首页>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
边栏推荐
- Row column (vertical and horizontal table) conversion of SQL
- Coredata acquisition in swift sorting, ascending, descending
- Talk about how the kotlin collaboration process establishes structured concurrency
- Unsupportedclassversionerror is reported when starting jar package. How to repair it
- POJ 1753 flip game (DFS 𞓜 bit operation)
- Esp32 (7): I2S and I2C drivers for function development
- The elegant combination of walle and Jianbao
- Maxiouassigner of mmdet line by line interpretation
- Opencv learning notes -day 12 (ROI region extraction and inrange() function operation)
- Resnet50+fpn for mmdet line by line code interpretation
猜你喜欢

Use Huawei performance management service to configure the sampling rate on demand

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

Duplicate entry '2' for key 'primary appears in JPA‘

ES6 learning path (II) let & const

Esp32 things (II): sharpening the knife without mistaking firewood - make preparations before project development

Maxiouassigner of mmdet line by line interpretation

Anchorgenerator for mmdet line by line interpretation

Based on svelte3 X desktop UI component library svelte UI

Express file download
随机推荐
Mmdet line by line code interpretation of positive and negative sample sampler
Use of Baidu face recognition API
Pipe pipe --namedpipe and anonymouspipe
C # get the current timestamp
ES6 learning path (IV) operator extension
Tutorial for beginners of small programs day01
Get to know handler again
QR code generation and analysis
List set export excel table
Row column (vertical and horizontal table) conversion of SQL
Deep understanding of kotlin collaboration context coroutinecontext
Opencv learning notes -day 11 (split() channel separation function and merge() channel merge function)
Torchvision loads the weight of RESNET except the full connection layer
JVM tuning related commands and explanations
Opencv learning notes -day2 (implemented by the color space conversion function cvtcolar(), and imwrite image saving function imwrite())
Talking about the difference between kotlin collaboration and thread
Rew acoustic test (V): equipment required for test
ES6 learning path (III) deconstruction assignment
Influencing factors of echo cancellation for smart speakers
Express get request