Created
October 16, 2024 19:54
-
-
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/db44cd886854c28a5578878d6354d00890a49e2e
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 NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2) | |
// 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