for expressions

forํ‘œํ˜„์‹์€ while let ํ‘œํ˜„์‹๊ณผ ๋งค์šฐ ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค. forํ‘œํ˜„์‹์€ ์ž๋™์œผ๋กœ into_iter()๋ฅผ ํ˜ธ์ถœํ•œ ๋‹ค์Œ ์ด๋ฅผ ๋ฐ˜๋ณตํ•ฉ๋‹ˆ๋‹ค.

The for expression is closely related to the while let expression. It will automatically call into_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 and continue here as usual.