Skip to content

Instantly share code, notes, and snippets.

@eholk
Created May 19, 2011 23:22
Show Gist options
  • Save eholk/982018 to your computer and use it in GitHub Desktop.
Save eholk/982018 to your computer and use it in GitHub Desktop.
Backwards while loop.
use std;
import std::vec;
fn main() {
auto v = [1, 2];
auto i = vec::len[int](v) - 1u;
while (i != 0u) {
log_err i;
log_err v.(i);
i -= 1u;
}
assert i == 0u;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment