This repository has been archived on 2023-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
rustlings-exercises-completed/old_curriculum/macros/macros2.rs

74 lines
459 B
Rust
Raw Normal View History

2018-02-22 00:09:53 -06:00
// macros2.rs
2017-03-17 09:30:29 -05:00
// Make me compile! Scroll down for hints :)
fn main() {
my_macro!();
}
macro_rules! my_macro {
() => {
println!("Check out my macro!");
};
}
2017-03-19 09:10:48 -05:00
// Macros don't quite play by the same rules as the rest of Rust, in terms of
// what's available where.
2017-03-17 09:30:29 -05:00
2017-03-19 09:10:48 -05:00
// Unlike other things in Rust, the order of "where you define a macro" versus
// "where you use it" actually matters.