Rust 程式設計影片教程對應講解內容-變數

linghuyichong發表於2019-12-09

頭條地址:https://www.ixigua.com/i676544267458235648...
B站地址:https://www.bilibili.com/video/av78062009?...
網易雲課堂地址:https://study.163.com/course/introduction....

const MAX_POINTS1: u32 = 100000; //const
fn main() {
    const MAX_POINTS: u32 = 100000; //const
    println!("MAX_POINTS = {}", MAX_POINTS); //
    println!("MAX_POINTS = {}", MAX_POINTS1); //
    //let a: u32 = 10; //inmut
    let mut a: u32 = 10;//mutable
    println!("a = {}", a);
    let b: String = String::from("Hello!");
    println!("b = {}", b);
    a = 20;
    println!("update a = {}", a);
    let b = 30; //hide
    println!("update b = {}", b);
    let a = String::from("this is a"); //hide
    println!("update second a = {}", a);
    println!("Hello, world!");
}

有問題歡迎大家在下面留言反饋

本作品採用《CC 協議》,轉載必須註明作者和本文連結
令狐一衝

相關文章