Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn is_odd?(input: i32) -> bool {
- match |input: i32| input & 1 = {
- 1 => true,
- 0 => false,
- }
- }
- fn main() -> Result<()> {
- let array = vec![1, 2, 3, 4, 5];
- for number in array.iter() {
- println!("{} is odd?: {}", number, is_odd?(number));
- }
- Ok(())
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement