Skip to content

Instantly share code, notes, and snippets.

@marijnh
Created March 23, 2012 13:53
Show Gist options
  • Save marijnh/2170846 to your computer and use it in GitHub Desktop.
Save marijnh/2170846 to your computer and use it in GitHub Desktop.
for vec::iter2(arr1, arr2) {|elt1, elt2|
if elt1 == "" { cont; }
if elt2 == "stop" { break; }
}
fn find_key(map: map<key, thing>, x: thing) -> key {
for map.items {|key, val|
if val == x { ret key; }
}
fail "not found";
}
========== >>> ===============
vec::iter2(arr1, arr2) {|elt1, elt2|
if elt1 == "" { ret true; }
if elt2 == "stop" { ret false; }
true
}
fn find_key(map: map<key, thing>, x: thing) -> key {
let __anon1 = none;
map.items {|key, val|
if val == x { __anon1 = some(key); ret false; }
true
}
alt __anon1 { some(v) { ret v; } none {} }
fail "not found";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment