Rust Flashcards
How would you create a function in rust?
To create a function, you use fn
keyword followed by the function name.
fn main(){}
What should be the function name that is the entry point to our rust code?
fn main
What is rust formatter called?
It is called rustfmt
How should we indent in rust?
We should use four spaces.
Difference between these two. println!()
and println()
println!()
is calling a rust macro, where as the other is calling a function.
When do we know we are calling a rust macro?
By using !
How should we end every expression?
We should end every expression of code with ;
.
What are expressions?
Calculate values.
What are statements?
Perform actions, which might include expressions.
What should we do before we run our rust program?
We first compile our rust program using rustc
.
When we compile our file with rustc
what files do we get in return?
We get main.exe
and main.pdb
.
What is main.exe
?
This will let us execute our code.
What is main.pdb
?
It contains debugging info.
What is wrong with compiling with just rustc
?
Its not flexible, we want to be able to do more than just compile.
What type of language is rust?
ahead of time compiled language.