From 4c2975c19b3a3e6e733ec365461c5f2fe91c17ac Mon Sep 17 00:00:00 2001 From: Nathan Stocks Date: Mon, 4 Oct 2021 21:31:54 -0600 Subject: [PATCH] Add the other implementations of the snuggle function in comments --- example/hello/src/lib.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/example/hello/src/lib.rs b/example/hello/src/lib.rs index 0b1690f..908e680 100644 --- a/example/hello/src/lib.rs +++ b/example/hello/src/lib.rs @@ -9,6 +9,22 @@ pub fn snuggle(bunnies: u128) -> u128 { bunnies << 3 } +// The typical, multiplication approach +// +// pub fn snuggle(bunnies: u128) -> u128 { +// bunnies * 8 +// } + +// The loop approach +// +// pub fn snuggle(bunnies: u128) -> u128 { +// let mut result = 0; +// for _ in 0..8 { +// result += bunnies +// } +// result +// } + #[cfg(test)] mod test { use std::num::ParseIntError;