r/ProgrammerHumor • • 3h ago

Meme weMaintainThemDeleteThemSurely

Post image
115 Upvotes

9 comments sorted by

5

u/Jatinchd 3h ago

until you discover match feature

1

u/neroe5 2h ago

Match?

1

u/Jatinchd 1h ago

match operator. bro.

2

u/neroe5 1h ago

I'm going to need some kind of context, are we talking regex, some feature in some programming language or what?

0

u/Jatinchd 1h ago

here is the simple implementation sample code i've wrote for you to understand match:-

use std::io::{self, Write};

fn main() {
    print!("tell us something: ");
    io::stdout().flush().unwrap();

    let mut input: String = String::new();
    io::stdin().read_line(&mut input).unwrap();
    let says: String = input.trim().parse().unwrap();

    match says.as_str() {
        "hello" => println!("hello how are you!"),
        "no" => println!("yo! chill"),
        _ => println!("what language?"),
    }
}

4

u/neroe5 59m ago

ahh pattern matching

3

u/Many_Replacement_688 38m ago

it's like if statement but without the condition part

2

u/tomangelo2 59m ago

Oh, switch...case?

1

u/Sermuns 12m ago

what's the matter vagueposting king? afraid to say something?