Skip to content

Instantly share code, notes, and snippets.

@kestein
Created March 9, 2016 21:02
Show Gist options
  • Save kestein/50a2c175d35bc1c5a4b0 to your computer and use it in GitHub Desktop.
Save kestein/50a2c175d35bc1c5a4b0 to your computer and use it in GitHub Desktop.
Rust conditional compile blocks
#![feature(stmt_expr_attributes)] // Need this in order to put the #[cfg] around a block
fn main() {
#[cfg(not(windows))] // Applies to the entire block OR the line directly after it
{
println!("HAHA, WINDOWS NERD");
println!("Richard Stallman > Bill Gates");
}
println!("All done.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment