Skip to content

Commit 1d68371

Browse files
committed
// macros2.rs
// // Execute `rustlings hint macros2` or use the `hint` watch subcommand for a // hint. // I AM NOT DONE // 先定义宏 macro_rules! my_macro { () => { println!("Check out my macro!"); }; } fn main() { // 后使用宏 my_macro!(); }
1 parent 24c8930 commit 1d68371

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

exercises/macros/macros2.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55

66
// I AM NOT DONE
77

8-
fn main() {
9-
my_macro!();
10-
}
11-
8+
// 先定义宏
129
macro_rules! my_macro {
1310
() => {
1411
println!("Check out my macro!");
1512
};
1613
}
14+
15+
fn main() {
16+
// 后使用宏
17+
my_macro!();
18+
}

0 commit comments

Comments
 (0)