Rust: Output


Example: Hello World in Rust


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

Output:

  Hello, world!


The keyword fn creates a function in Rust. main is a special function and is the first line that runs in every executable Rust program. The main function has no parameters and returns nothing.

Rust requires curly braces {} in all function bodies. println! prints text to the screen. The Rust style is to indent with four spaces, not a tab. println! calls a Rust macro, not a function. If it were a function, it would be written println without the !. ! menas the code is calliung a macro.

Hello, world! is a parameter being passed to println!. Most lines in Rust end with a semi-colon ;.