Functions


Functions ,Just like in other programming languages, is a piece of code which performs an action that can be used repeatedly.

fn main(){
	println!("Hello world!");
}

Here main is a function

Macros


Macros are built in functions that help you do specific tasks

fn main(){
	println!("Hello world!");
}
 

Here println is a macro - we can identify macros with ! sign after macro name.

println! vs print!


println! macro adds a new line to the output but !print doesn’t. So println! is prefered over !print

Comments


//this is a single line comment
 
/*
This is a 
multiline comment
*/