Browse Source

looping

`for` loops only support looping over iterable things, not explicit
looping.  maybe there is support for something like `(0..10).step(2)` or
similar.  `while` exists as well.  for infinite loops `loop` should be
used to help the compiler along.
Lucas Stadler 11 years ago
parent
commit
be4e3a9945
1 changed files with 5 additions and 0 deletions
  1. 5 0
      rust/book/src/main.rs

+ 5 - 0
rust/book/src/main.rs

87
    print_num_type(i);
87
    print_num_type(i);
88
    print_num_type(f);
88
    print_num_type(f);
89
    print_num_type(n);
89
    print_num_type(n);
90
91
    // loops
92
    for x in 0..10 {
93
        println!("{}", x);
94
    }
90
}
95
}