diff options
| author | bors <bors@rust-lang.org> | 2013-05-30 20:28:48 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-05-30 20:28:48 -0700 |
| commit | f8cef24b5e1decd9ce97c7635dd5a903a5b6fc9b (patch) | |
| tree | 2c49b514c338b2f4c81f07f5ea565db56b8fb451 /src/libstd | |
| parent | 3869f7a99c54f00d69b19298f215cbc4a84ce5a8 (diff) | |
| parent | 220e1a6cfc0b44ee04b38e5373ca9d2b4eb12963 (diff) | |
| download | rust-f8cef24b5e1decd9ce97c7635dd5a903a5b6fc9b.tar.gz rust-f8cef24b5e1decd9ce97c7635dd5a903a5b6fc9b.zip | |
auto merge of #6841 : steveklabnik/rust/range_docs, r=thestinger
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/num/uint_macros.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs index c2e722f9e0e..bdb74f7e191 100644 --- a/src/libstd/num/uint_macros.rs +++ b/src/libstd/num/uint_macros.rs @@ -64,9 +64,18 @@ pub fn ge(x: $T, y: $T) -> bool { x >= y } pub fn gt(x: $T, y: $T) -> bool { x > y } #[inline(always)] -/// -/// Iterate over the range [`start`,`start`+`step`..`stop`) -/// +/** + * Iterate through a range with a given step value. + * + * # Examples + * ~~~ {.rust} + * let nums = [1,2,3,4,5,6,7]; + * + * for uint::range_step(0, nums.len() - 1, 2) |i| { + * println(fmt!("%d & %d", nums[i], nums[i+1])); + * } + * ~~~ + */ pub fn range_step(start: $T, stop: $T, step: $T_SIGNED, it: &fn($T) -> bool) -> bool { let mut i = start; if step == 0 { |
