Add an infinite loop construct

Add a loop {} construct for infinite loops, and use it in test
cases. See #1906 for details.
This commit is contained in:
Tim Chevalier
2012-03-09 16:11:56 -08:00
parent 4ffcb95974
commit 321fd80219
33 changed files with 208 additions and 122 deletions

View File

@@ -138,7 +138,7 @@ fn range(lo: uint, hi: uint, it: fn(uint)) {
}
/*
Function: loop
Function: iterate
Iterate over the range [`lo`..`hi`), or stop when requested
@@ -153,7 +153,7 @@ Returns:
`true` If execution proceeded correctly, `false` if it was interrupted,
that is if `it` returned `false` at any point.
*/
fn loop(lo: uint, hi: uint, it: fn(uint) -> bool) -> bool {
fn iterate(lo: uint, hi: uint, it: fn(uint) -> bool) -> bool {
let mut i = lo;
while i < hi {
if (!it(i)) { ret false; }