Skip to content

Commit f8cef24

Browse files
committed
auto merge of #6841 : steveklabnik/rust/range_docs, r=thestinger
2 parents 3869f7a + 220e1a6 commit f8cef24

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/libstd/num/uint_macros.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,18 @@ pub fn ge(x: $T, y: $T) -> bool { x >= y }
6464
pub fn gt(x: $T, y: $T) -> bool { x > y }
6565

6666
#[inline(always)]
67-
///
68-
/// Iterate over the range [`start`,`start`+`step`..`stop`)
69-
///
67+
/**
68+
* Iterate through a range with a given step value.
69+
*
70+
* # Examples
71+
* ~~~ {.rust}
72+
* let nums = [1,2,3,4,5,6,7];
73+
*
74+
* for uint::range_step(0, nums.len() - 1, 2) |i| {
75+
* println(fmt!("%d & %d", nums[i], nums[i+1]));
76+
* }
77+
* ~~~
78+
*/
7079
pub fn range_step(start: $T, stop: $T, step: $T_SIGNED, it: &fn($T) -> bool) -> bool {
7180
let mut i = start;
7281
if step == 0 {

0 commit comments

Comments
 (0)