官术网_书友最值得收藏!

Using Variables and Types

In this chapter, we look at the basic building blocks of a Rust program, like variables and types. We discuss variables of primitive types, whether their type has to be declared or not, and the scope of variables. Immutability, one of the cornerstones of Rust's safety strategy, is also discussed and illustrated.

We will cover the following topics:

  • Comments
  • Global constants
  • Values and primitive types
  • Binding variables to values
  • Scope of a variable and shadowing
  • Type checking and conversions
  • Expressions
  • The stack and the heap

Our code examples will center on building a text-based game called Monster Attack.

主站蜘蛛池模板: 梁河县| 南丹县| 浪卡子县| 洪江市| 钟祥市| 武强县| 新疆| 绥滨县| 定襄县| 紫云| 衡南县| 隆子县| 永安市| 育儿| 汝州市| 彰化市| 延津县| 鄯善县| 清水河县| 宜君县| 崇文区| 佳木斯市| 罗城| 石景山区| 宁海县| 剑河县| 民丰县| 鲜城| 崇文区| 新晃| 乌兰察布市| 涪陵区| 六盘水市| 芒康县| 纳雍县| 内丘县| 贡觉县| 桂阳县| 霸州市| 辽宁省| 晋中市|