Rust
This is supposed to be a hard language, but I still want to try. And the followings are some tips for Rust during the learning process.
What is the simplest rust program like?
fn main() { println!("Hello, world!"); }
Here is the simplest rust program. As the most C-like programs, the entry point of a Rust program is a
main()
function, where it is declared with a fn
keyword, as short for function.The standard print statement for putting a new line of string is with
println!
function.You might want to ask, why we need an exclamation mark after the
println
?The reason is very simple. Adding an exclamation mark after the
println
tells the rust compiler that, we are not calling a function println
, but an extension which also enables possible string formatting (and actually it is calling a Rust macro).