This commit is contained in:
Brian Anderson
2011-12-17 16:45:13 -08:00
parent 128621be97
commit aeadc6269e
5 changed files with 88 additions and 1 deletions

View File

@@ -6,6 +6,7 @@
import option::{some, none};
import option = option::t;
export option, some, none;
export repeat;
// Export the log levels as global constants. Higher levels mean
// more-verbosity. Error is the bottom level, default logging level is
@@ -15,3 +16,16 @@ const error : int = 0;
const warn : int = 1;
const info : int = 2;
const debug : int = 3;
/*
Function: repeat
Execute a function for a set number of times
*/
fn repeat(times: uint, f: block()) {
let i = 0u;
while i < times {
f();
i += 1u;
}
}