while
This commit is contained in:
@@ -22,3 +22,4 @@
|
||||
- https://tinchicus.com/2022/06/29/rust-el-parametro-_/ (bucles2)
|
||||
- https://tinchicus.com/2022/06/30/rust-loop-27/ (arreglos2)
|
||||
- https://tinchicus.com/2022/07/01/rust-loop-labels/ (nombre)
|
||||
- https://tinchicus.com/2022/07/04/rust-while/ (whileloop)
|
||||
|
||||
8
whileloop/Cargo.toml
Normal file
8
whileloop/Cargo.toml
Normal file
@@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "whileloop"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
9
whileloop/src/main.rs
Normal file
9
whileloop/src/main.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
fn main() {
|
||||
let mi_arreglo = ["Lovecraft", "Poe", "Barker", "King"];
|
||||
let mut i = 0;
|
||||
|
||||
while i < mi_arreglo.len() {
|
||||
println!("{}", mi_arreglo[i]);
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user