Skip to content

Instantly share code, notes, and snippets.

@juliarose
Created January 7, 2023 17:04
Show Gist options
  • Save juliarose/c978ac8e07bc581a7de0c7263f046693 to your computer and use it in GitHub Desktop.
Save juliarose/c978ac8e07bc581a7de0c7263f046693 to your computer and use it in GitHub Desktop.
fn expensive() -> bool {
println!("expensive");
true
}
fn main() {
// expensive is not executed when previous statement is false
if false && expensive() {
println!("Hello, world!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment