mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-11-08 09:09:17 +01:00
macros4 solution
This commit is contained in:
parent
4cb15a4cda
commit
cc2c0958c9
@ -1,3 +1,4 @@
|
|||||||
|
// TODO: Fix the compiler error by adding one or two characters.
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
macro_rules! my_macro {
|
macro_rules! my_macro {
|
||||||
() => {
|
() => {
|
||||||
|
@ -1 +1,15 @@
|
|||||||
// Solutions will be available before the stable release. Thank you for testing the beta version 🥰
|
// 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);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
my_macro!();
|
||||||
|
my_macro!(7777);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user