From 1f51efd295166bc13e0b444e77487e047ffdef6e Mon Sep 17 00:00:00 2001 From: ftabaro Date: Sun, 7 Oct 2018 20:25:07 +0300 Subject: [PATCH] add simple rust example :D --- README.md | 6 ++++++ code/ftabaro/Cargo.toml | 7 +++++++ code/ftabaro/src/main.rs | 26 ++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 code/ftabaro/Cargo.toml create mode 100644 code/ftabaro/src/main.rs diff --git a/README.md b/README.md index 06ba005..cd9604e 100644 --- a/README.md +++ b/README.md @@ -349,6 +349,12 @@ Please note that this project is released with a [Code of Conduct](CODE_OF_CONDU - I share as I learn at [DIY DS](https://www.instagram.com/dodsyourself/) and [DIY CS](https://www.instagram.com/docsyourself/) on instagram. - Started from the bottom, now we here: [![github-alt][github-img]](https://github.com/festusdrakon) +### Francesco Tabaro +- Bioinformatics PhD student +- Interested in data science, web development and cooking +- [![twitter-alt][twitter-img]](https://twitter.com/FrancescoTabaro) + [![github-alt][github-img]](https://github.com/ftabaro) + ### Francisco Nievas (frannievas) - Computer science student - Nerd, geek, gamer, I love TLoK diff --git a/code/ftabaro/Cargo.toml b/code/ftabaro/Cargo.toml new file mode 100644 index 0000000..5d77c54 --- /dev/null +++ b/code/ftabaro/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "ftabaro" +version = "0.1.0" +authors = ["ftabaro "] + +[dependencies] +rand = "0.5.5" \ No newline at end of file diff --git a/code/ftabaro/src/main.rs b/code/ftabaro/src/main.rs new file mode 100644 index 0000000..5d5cb4b --- /dev/null +++ b/code/ftabaro/src/main.rs @@ -0,0 +1,26 @@ +extern crate rand; + +use rand::prelude::*; + +fn main() { + let mut obv = 0; + let mut rev = 0; + let mut i = 0; + + while i < 10 { + if random() { + obv += 1; + } else { + rev += 1; + } + i += 1; + } + + if obv > rev { + println!("Obverse wins!") + } else { + println!("Reverse wins!") + } + + println!("Get info about coin history at https://en.wikipedia.org/wiki/Obverse_and_reverse") +} \ No newline at end of file