diff --git a/README.md b/README.md index 5c6f992..ff29ee0 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/whileloop/Cargo.toml b/whileloop/Cargo.toml new file mode 100644 index 0000000..713d13a --- /dev/null +++ b/whileloop/Cargo.toml @@ -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] diff --git a/whileloop/src/main.rs b/whileloop/src/main.rs new file mode 100644 index 0000000..1e24967 --- /dev/null +++ b/whileloop/src/main.rs @@ -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; + } +}