rust控制流

if表达式的条件必须是bool类型
在if表达式中与条件相关的
fn main() {
    let _x = true;
    let _y = if _x { 5 } else { 6 };
    println!("_y = {}", _y);
}

  

代码块就叫做分支arm
posted @ 2026-08-12 16:53  华腾智算  阅读(1)  评论(0)    收藏  举报
https://damo.alibaba.com/ https://tianchi.aliyun.com/course?spm=5176.21206777.J_3941670930.5.87dc17c9BZNvLL