hem1t / elif

A macro, to write if-else-if-else statements without using the keywords.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

elif!

Motive: Just for Fun (Nothing)

Well, I just don't like to use else if, I liked elif much better, so, tried to create a macro which would let me use elif instead of else if, but even instead of that I came with something else, you can see in below example.

Example

    let num = // be a random value.
    elif! {
        (num == 1) "One", // <-- End with `,`
        // ^------------ This one will go to if block
        // After first one every one else will be else if block
        (num == 2) {      // <--- You can use {}
            
        },
        () { "None" }
    //   ^ --- Empty condition will create else block
    }
Thank You!

About

A macro, to write if-else-if-else statements without using the keywords.


Languages

Language:Rust 100.0%