Compile and run a Rust program from scratch

Share this video with your friends

Send Tweet

In this lesson we’ll create our first “Hello World” Rust program from scratch and will learn how to compile it using rustc.

Michele Nasti
Michele Nasti
~ 5 years ago

Why println! function has the exclamation mark at the end? Is this special, a convention, or it's just part of the function name?

Roberto Zaniboni
Roberto Zaniboni
~ 5 years ago

It is a macro. https://doc.rust-lang.org/rust-by-example/macros.html

Pascal Precht
Pascal Precht(instructor)
~ 5 years ago

Hi Michele!

As Roberto pointed out, println! is a macro and not just a function. In this course however, I didn't want to go into macros to keep things as simple as possible. So from that perspective, all you needed to know was that println!() is a function for now :)

There will be a course on macros as well, once I've mastered them! :D

J. Matthew
J. Matthew
~ 5 years ago

Why println! function has the exclamation mark at the end? Is this special, a convention, or it's just part of the function name?

Thanks for asking this; I was wondering the same thing!

Macros sound interesting, based on a quick look at the link @Roberto provided. I look forward to learning more about them (but I appreciate that complexity not being introduced in this video).

Pascal Precht
Pascal Precht(instructor)
~ 5 years ago

Macros are extremely powerful but not easy to master. I've read into them a while ago and decided to put them aside for now. Glad to hear there's interest in a dedicated course on that! :)