[][src]Function tao_of_rust::ch02::function::lexical_scope

pub fn lexical_scope()

词法作用域

Basic usage:

pub fn lexical_scope(){
    let v = "hello world!";
    assert_eq!(v, "hello world!");
    let v = "hello Rust!";
    assert_eq!(v, "hello Rust!");
    {
        let v = "hello World!";
        assert_eq!(v, "hello World!");
    }
    assert_eq!(v, "hello Rust!");
}
lexical_scope();Run