rust-ape-example/src/bin/macros.rs

22 lines
380 B
Rust

// ./src/macros.md
// This is a simple macro named `say_hello`.
macro_rules! say_hello {
// `()` indicates that the macro takes no argument.
() => {
// The macro will expand into the contents of this block.
println!("Hello!");
};
}
fn part0() {
// This call will expand into `println!("Hello");`
say_hello!()
}
pub fn main() {
part0();
}