Constant
This commit is contained in:
parent
b4b6a958f3
commit
f8eb855c15
1 changed files with 6 additions and 12 deletions
18
src/main.rs
18
src/main.rs
|
@ -1,19 +1,13 @@
|
|||
use chrono::{offset::Local, Datelike, Weekday};
|
||||
use rand::Rng;
|
||||
use chrono::Datelike;
|
||||
|
||||
fn main() {
|
||||
let foods = [ "Kapsalon"
|
||||
, "Pizza"
|
||||
, "Lasagne"
|
||||
, "Nachos"
|
||||
, "Friet"
|
||||
, "Durum"
|
||||
];
|
||||
let rnd_num = rand::thread_rng().gen_range(0..foods.len());
|
||||
let weekday = chrono::offset::Local::now().date_naive().weekday();
|
||||
const FOODS: [&str; 6] = ["Kapsalon", "Pizza", "Lasagne", "Nachos", "Friet", "Durum"];
|
||||
let rnd_num = rand::thread_rng().gen_range(0..FOODS.len());
|
||||
let weekday = Local::now().date_naive().weekday();
|
||||
let output_string = match weekday {
|
||||
chrono::Weekday::Tue => "Friet",
|
||||
_ => foods[rnd_num]
|
||||
Weekday::Tue => "Friet",
|
||||
_ => FOODS[rnd_num],
|
||||
};
|
||||
println!("{}", output_string)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue