This website requires JavaScript.
Explore
Help
Sign in
manuth
/
rust-exercises
Watch
1
Star
0
Fork
You've already forked rust-exercises
0
Code
Issues
Pull requests
Projects
Releases
Packages
Wiki
Activity
Actions
808b8f58b0
rust-exercises
/
loops
/
src
/
main.rs
8 lines
123 B
Rust
Raw
Normal View
History
Unescape
Escape
Add code for demonstrating loops
2024-10-16 15:15:51 +00:00
fn
main
(
)
{
Create an array iterator
2024-10-16 15:27:33 +00:00
let
a
=
[
10
,
20
,
30
,
40
,
50
]
;
Create a `loop` with a `break` statement
2024-10-16 15:16:14 +00:00
Update the code to use a `for` loop
2024-10-16 15:27:46 +00:00
for
element
in
a
{
println!
(
"
the value is:
{element}
"
)
;
Create a nested loop
2024-10-16 15:18:24 +00:00
}
}
Reference in a new issue
Copy permalink