Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

บทที่ 2: Variables & Data Types - ตัวแปรและชนิดข้อมูล

ในบทนี้เราจะเรียนรู้พื้นฐานที่สำคัญของทุกภาษาโปรแกรม นั่นคือ ตัวแปร และ ชนิดข้อมูล


สิ่งที่จะได้เรียนรู้

หัวข้อคำอธิบาย
Mutabilityตัวแปรแบบเปลี่ยนค่าได้และเปลี่ยนไม่ได้
Data Typesชนิดข้อมูลต่างๆ ใน Rust
Constantsค่าคงที่และ Shadowing

ทำไมต้องเข้าใจ?

ใน Rust ตัวแปรมีความพิเศษ:

  1. Immutable by default - ตัวแปรเปลี่ยนค่าไม่ได้โดยปกติ
  2. Type inference - Rust เดาชนิดข้อมูลให้ได้
  3. Strongly typed - ต้องระบุชนิดข้อมูลให้ชัดเจน

เริ่มกันเลย!

👉 Mutability