📜  rust for each - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:28.408000             🧑  作者: Mango

代码示例1
// for
for n in 1..101 {}
// collection is untouched and can't be modified
for name in names.iter() {}
// collection is extracted and no longer available after
for name in names.into_iter() {}
// collection can be modified within the loop
for name in names.iter_mut() {}