Search
 
SCRIPT & CODE EXAMPLE
 

RUST

sort a vec rust

fn main() {
    let mut v: [f32; 5] = [5.0, 4.0, 1.0, 3.0, 2.0];
    v.sort_by(|a, b| a.partial_cmp(b).unwrap());
    assert!(v == [1.0, 2.0, 3.0, 4.0, 5.0]);
}
Comment

PREVIOUS NEXT
Code Example
Rust :: create thread in rust 
Rust :: convert string to i32 rust 
Rust :: rust sum vector 
Rust :: rust nesting and labels loop 
Rust :: vector in rust 
Rust :: how to make an array in rust 
Rust :: 2d vector rust 
Rust :: bevy input 
Rust :: read line rust 
Rust :: rust convert a string (with decimals) to a floating point number. 
Rust :: rust iterate vector backwards 
Rust :: armanriazi•rust•pattern•design•interior•mutability 
Rust :: transpose a matrix 
Rust :: rust count distinct elements in list 
Rust :: packet sniffing with rust 
Rust :: rust•armanriazi•lifetime•unsafe•destructor 
Rust :: rust iterate over split 
Rust :: get value from option rust 
Rust :: rust init vector with range 
Rust :: armanriazi•rust•function•vs•closure 
Lua :: print table lua 
Lua :: how to get last element of array in lua 
Lua :: roblox get player by name 
Lua :: luau table find 
Lua :: how to make a color changing brick in roblox studio 
Lua :: repeat until in lua 
Lua :: to the power of in lua 
Lua :: rhyme api 
Lua :: how do i use the enums module lua assist 
Lua :: In range loop 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =