Просмотр исходного кода

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 лет назад: 10
Родитель
Сommit
be4e3a9945
1 измененных файлов с 5 добавлено и 0 удалено
  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
}