rustlings/solutions/21_macros/macros4.rs

16 lines
288 B
Rust
Raw Normal View History

2024-11-09 11:43:57 +00:00
// Added semicolons to separate the macro arms.
#[rustfmt::skip]
macro_rules! my_macro {
() => {
println!("Check out my macro!");
};
($val:expr) => {
println!("Look at this other macro: {}", $val);
};
}
2024-10-28 20:46:17 +00:00
fn main() {
2024-11-09 11:43:57 +00:00
my_macro!();
my_macro!(7777);
2024-10-28 20:46:17 +00:00
}