for
expressions
for
ํํ์์ while let
ํํ์๊ณผ ๋งค์ฐ ์ ์ฌํฉ๋๋ค. for
ํํ์์ ์๋์ผ๋ก into_iter()
๋ฅผ ํธ์ถํ ๋ค์ ์ด๋ฅผ ๋ฐ๋ณตํฉ๋๋ค.
The
for
expression is closely related to thewhile let
expression. It will automatically callinto_iter()
on the expression and then iterate over it:
fn main() { let v = vec![10, 20, 30]; for x in v { println!("x: {x}"); } }
์ญ์ ๋ค๋ฅธ์ธ์ด์ ๋ง์ฐฌ๊ฐ์ง๋ก break
์ continue
๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
You can use
break
andcontinue
here as usual.