Search
 
SCRIPT & CODE EXAMPLE
 

RUST

rust filtering a vector example

let numbers: Vec<i32> = vec![
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
];

let even_numbers = numbers
  .into_iter()
  .filter(|n| n % 2 == 0)
  .collect::<Vec<_>>();

println!("{:?}", even_numbers);
Comment

PREVIOUS NEXT
Code Example
Rust :: ignore #[warn(dead_code)] 
Rust :: rust size of type 
Rust :: rust request get headers 
Rust :: how to concatenate two &str in rust 
Rust :: how to make an array in rust 
Rust :: read file rust 
Rust :: rust string contains 
Rust :: actix web hello world 
Rust :: rust javascript 
Rust :: ndarray rust 
Rust :: rust concat 
Rust :: rust initialize struct 
Rust :: rust vector insert 
Rust :: Repeat the given string exactly n times 
Rust :: armanriazi•rust•reference•vs•pointer 
Rust :: armanriazi•rust•reference•dangle 
Rust :: rust return the result with trait exit status 
Rust :: rust-analyzer tab space 
Rust :: rust•armanriazi•slice•vs•char•vec 
Rust :: rust compiler error 
Lua :: luau make a rainbow part 
Lua :: lua calculate average number 
Lua :: roblox part tween 
Lua :: roblox studio part color randomiser 
Lua :: lua sort 
Lua :: What is BreakJoints roblox? 
Lua :: roblox studio rain 
Lua :: roblox get how many players in server 
Lua :: pico8 draw sprite 
Lua :: roblox for loop 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =