Last active
February 3, 2026 20:20
-
-
Save dacr/37082754d52b76a79f6fa4ca68634aae to your computer and use it in GitHub Desktop.
hello rust lambdas / published by https://github.com/dacr/code-examples-manager #ddfca10d-16be-42ca-b450-adf127e2a32e/759927b5ed375dcaf52f712a635722e7dedd5054
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env rust-script | |
| // summary : hello rust lambdas | |
| // keywords : rust, lambdas, @testable | |
| // publish : gist | |
| // authors : David Crosson | |
| // license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | |
| // id : ddfca10d-16be-42ca-b450-adf127e2a32e | |
| // created-on : 2024-10-15T17:09:28+02:00 | |
| // managed-by : https://github.com/dacr/code-examples-manager | |
| // run-with : ./$file | |
| fn main() { | |
| let sumit = |a: u64, b: u64| a + b; | |
| let x = 20; | |
| let y = 22; | |
| println!("{x}+{y} = {}", sumit(x, y)); | |
| let mulit = |a: u64, b: u64| a * b; | |
| let square = |a: u64| mulit(a, a); | |
| println!("{x}*{x} = {}", square(x)); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment