use std::io::stdin;
struct Visitor {
name: String,
greeting: String
}
impl Visitor {
fn new(name: &str, greeting: &str) -> Self {
Self {
name: name.to_lowercase(),
greeting: greeting.to_string(),
}
}
fn greet_visitor(&self) {
println!("{}", self.greeting);
}
}
fn main() {
println!("Hello, what's your name?");
let your_name = what_is_your_name();
if your_name == "bert" {
println!("Hello, {:?}", your_name);
} else {
println!("No, {}, Just no", your_name)
}
let visitor_list: [&str; 2] = ["bert", "ernie"];
for i in 0..=10 {
println!("{}", i);
}
let mut allow = false;
for v in 0..visitor_list.len() {
if visitor_list[v] == your_name {
allow = true;
println!("Yeah, whatever {}", your_name);
}
}
if allow {
println!("OK, {}. After much debate. You smell!", your_name)
}
}
fn what_is_your_name() -> String {
let mut your_name = String::new();
stdin().read_line(&mut your_name).expect("FAAIIIILLLED!!!");
your_name.trim().to_lowercase()
}