Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active February 3, 2026 20:20
Show Gist options
  • Select an option

  • Save dacr/37082754d52b76a79f6fa4ca68634aae to your computer and use it in GitHub Desktop.

Select an option

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
#!/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