Chooce video playback speed
speed:1
  1. 34
    Rustlings macros1: Writing your first macro
    23s

Rustlings macros1: Writing your first macro

InstructorChris Biscardi

Share this video with your friends

Send Tweet

README for this exercise.

This lesson is a Community Resource

A Community Resource means that it’s free to access for all. The instructor of this lesson requested it to be open to the public.

Chris Biscardi: In macros1, we learn how to define our first macro. In this case, we use the macro_rules macro to define a macro with the name my_macro that returns a function that uses the println macro to print "Check out my macro."

The Rust compiler tells us that we cannot find function my_macro in scope. This is because we're not calling a function here. We're calling a macro. Macros are called with an exclamation point.