Control Flow

์•ž์—์„œ ์‚ดํŽด๋ณธ ๋ฐ”์™€ ๊ฐ™์ด ๋Ÿฌ์ŠคํŠธ์˜ ํ‘œํ˜„์‹์œผ๋กœ์จ if๋Š” ๋‘ ๋ธ”๋ก ์ค‘ ํ•˜๋‚˜๋ฅผ ์กฐ๊ฑด์— ๋”ฐ๋ผ ํ‰๊ฐ€(๋ฐ˜ํ™˜)ํ•˜๋ฉฐ, ๋ธ”๋ก์€ if ํ‘œํ˜„์‹์˜ ๊ฐ’์ด ๋˜๋Š” ๊ฐ’์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ํ๋ฆ„์ œ์–ด ํ‘œํ˜„์‹๋„ ๋Ÿฌ์ŠคํŠธ์—์„œ ์œ ์‚ฌํ•˜๊ฒŒ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค.

As we have seen, if is an expression in Rust. It is used to conditionally evaluate one of two blocks, but the blocks can have a value which then becomes the value of the if expression. Other control flow expressions work similarly in Rust.