-
Rust연습-Mutability_ In Rust, variable bindings are immutable by default.코딩Coding/Rust연습 2021. 5. 8. 09:34728x90
In Rust, variable bindings are immutable by default. When a variable is immutable, after a value is bound to a name, you can't change that value.
fn main() { let mut a_number = 10; // notice the `mut` keyword println!("the number is {}.", a_number); a_number = 15; println!("and now the number is {}.", a_number); }
결과
https://docs.microsoft.com/en-us/learn/modules/rust-understand-common-concepts/2-variables▷ 다른글 보기 ◁
★★★Rust Toturial 로드맵(Road Map)첫시작!-★★★(총정리)Rustacean이 되어 보자!!Let's go! (tistory.com)
반응형'코딩Coding > Rust연습' 카테고리의 다른 글
Rust연습_문자 및 문자열출력Character and strings (0) 2021.05.08 Rust연습_ The default type is f64. On modern CPUs, the f64 type is roughly the same speed as the f32 type, but it has more precision. (0) 2021.05.08 Rust연습_문자열을 숫자로 변환해야 하고 .parse() 메서드를 사용 (0) 2021.05.08 Rust연습-Shadowing (0) 2021.05.08 Rust연습_데이터 형식 알아보기(u32, i32..) (0) 2021.05.08 Rust연습_변수 만들고 출력(Create and use variables) (0) 2021.05.08 Rust연습_탐색기창에서VSCode불러오고TestRust프로젝트만들기(첫문서) (0) 2021.05.08 rust연습_속도란 바로 rust가 짱 ㅋㅋ (0) 2020.09.10