20 lines
366 B
Rust
20 lines
366 B
Rust
|
fn main() {
|
||
|
let mut v = [4.1, -5.1, 1.1, -3.1, 2.1];
|
||
|
v.sort_by(f64::total_cmp);
|
||
|
|
||
|
println!("Hello, world!");
|
||
|
for el in v {
|
||
|
println!("Element {}.", el);
|
||
|
}
|
||
|
|
||
|
let mut v = vec![5, 2, 1];
|
||
|
v.push(2);
|
||
|
v.push(5);
|
||
|
|
||
|
for (idx, elem) in v.iter().enumerate() {
|
||
|
println!("Val: {}. {}.", idx, elem);
|
||
|
}
|
||
|
|
||
|
println!("Done");
|
||
|
}
|