Created
August 27, 2014 10:46
-
-
Save aarroyoc/54147f853a8a2b8c01d9 to your computer and use it in GitHub Desktop.
pushAndPop.rs
This file contains 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
fn push(&mut self, value: u8) -> (){ | |
self.stack.push(value); | |
} | |
fn pop(&mut self) -> u8{ | |
let a: Option<u8>=self.stack.pop(); | |
match a{ | |
None => { | |
println!("Failed to pop"); | |
0 | |
}, | |
Some(result) => { | |
result | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment