[][src]Function show_notes::e004::demonstrate_closure_environment

pub fn demonstrate_closure_environment()

Shows how closures can act on elements within their environment.

Closures are handy for more than merely a quick and easy way to write a callback; they also serve as one possible way to hide information or implementation details. While that's not as strictly necessary in Rust as it is in e.g. JavaScript, it still has a great deal of utility, especially in more functional programming styles.