let my_array=["One, Two"];
- We can use
my_array.thdaoethothed();
to get our arrays' type.
-
If we remove
fn main(){ let name1="Windy"; let name2="Gomesy"; let name3="MB"; let mut my_vec=Vec::new(); my_vec.push(name1); }
my_vec.push(name1);
, it will return an error because the complier does not know the type of elements in the vector. let my_vec: Vec<String> = Vec::new();
let my_vec=vec![7,8,9,10];
We can create a vector like this.let vec_of_ten=vec![1,2,3,4,5,6,7,8,9,10];
let three_to_five=&vec_of_ten[2..5];
We can use references to split the vector.- We can use
my_vec.capacity()
to get the capacity of a vector.