while ๋ฐ˜๋ณต๋ฌธ

while ํ‚ค์›Œ๋“œ๋Š” ๋‹ค๋ฅธ ์–ธ์–ด์™€ ๋งค์šฐ ๋น„์Šทํ•˜๊ฒŒ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค:

fn main() {
    let mut x = 10;
    while x != 1 {
        x = if x % 2 == 0 {
            x / 2
        } else {
            3 * x + 1
        };
    }
    println!("Final x: {x}");
}