Rust Flashcards

1
Q

How would you create a function in rust?

A

To create a function, you use fn keyword followed by the function name.

fn main(){}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What should be the function name that is the entry point to our rust code?

A

fn main

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is rust formatter called?

A

It is called rustfmt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How should we indent in rust?

A

We should use four spaces.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Difference between these two.
println!() and println()

A

println!() is calling a rust macro, where as the other is calling a function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

When do we know we are calling a rust macro?

A

By using !

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How should we end every expression?

A

We should end every expression of code with ;.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are expressions?

A

Calculate values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are statements?

A

Perform actions, which might include expressions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What should we do before we run our rust program?

A

We first compile our rust program using rustc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

When we compile our file with rustc what files do we get in return?

A

We get main.exe and main.pdb.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is main.exe?

A

This will let us execute our code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is main.pdb?

A

It contains debugging info.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is wrong with compiling with just rustc?

A

Its not flexible, we want to be able to do more than just compile.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What type of language is rust?

A

ahead of time compiled language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does ahead of time compiled language mean?

A

We can compile a program and give the executable to someone else.

17
Q
A