In Rust, it is possible to force-ably allocate values on the heap using the Box type, here is an example of an i32 value allocated on the heap.
age is now a pointer to a heap allocated i32.
Rust lets you iterate through something iterable using an Iterator. Here's an example of filtering an array for even numbers.
We create an Iterator from our array using into_iter in this case, a version of iter that moves ownership of each value into our closure.
ALT fn main() {
let x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
let y: Vec<i32> = x.into_iter().filter(|a| a % 2 == 0).collect();
println!("{:?}", y); // [2, 4, 6, 8, 10]
}