Functions

I find functions funny in rust

fn main() {
    println!("{}", something_test());

    fn something_test() -> u8 {
        1
    }
}

Could you look at the above function? Find anything interesting? Unlike other languages that I have come across so far, you could easily do something like this above in rust.

Defining functions within a function. Rust really doesn't care how you define functions as long as the syntax in correct :)

Last updated

Was this helpful?