Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- let mut items = vec![1, 2, 3, 4, 5];
- for i0 in 0..items.len() {
- for i1 in i0 + 1..items.len() {
- if matches(items[i0], items[i1]) {
- items[i1] = 40; // for example
- }
- }
- }
- println!("{:?}", items);
- }
- fn matches(i0: i32, i1: i32) -> bool {
- i0 + i1 == 5 // for example
- }
Add Comment
Please, Sign In to add comment