Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

armanriazi•rust•closures•anonymous•lambda•loosely

Closures are also known as anonymous functions and lambda functions. 
(|...|) followed by curly brackets ({...}). The pair of vertical bars lets you define arguments. Lambda functions in Rust can read variables from within their scope. These are closures.
Unlike regular functions, lambda functions cannot be defined in global scope(out of main).
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
2+9 =