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

Chapter 2. Building a Foundation with D Fundamentals

In this chapter and the next, we're going to look at the fundamental building blocks of D programming. There's a lot of information to cover, so our focus in both chapters will primarily be on the syntax, differences from other C-family languages, and how to avoid common beginner mistakes.

If you enter the code snippets into a text editor and try to compile them as you work through this chapter and the rest of the book, please keep the following in mind. Many of the snippets make use of one or more functions from std.stdio. In order to be successfully compiled, they all require a main function. However, both declarations are often missing from the snippets listed in the book in the interest of saving space. Use the following as a template to implement any such snippets yourself:

import std.stdio;
void main() {
    // Insert snippet here
}

Here's how this chapter is going to play out:

  • The very basics: Identifiers, scope, modules, comments, variable declarations, and initialization
  • Basic types: Integral and floating-point types, aliases, properties, and operators
  • Derived data types: Pointers, arrays, strings, and associative arrays
  • Control flow statements: Loops, conditionals, scope, and go to statements
  • Type qualifiers: Immutable and const
  • Functions: Everything to do with functions
  • MovieMan: The first steps
主站蜘蛛池模板: 景宁| 太和县| 阳谷县| 澜沧| 南岸区| 峨边| 兴业县| 靖江市| 元氏县| 马龙县| 如东县| 德江县| 清丰县| 临泉县| 丹巴县| 禹城市| 霍州市| 色达县| 托里县| 敖汉旗| 建始县| 涞源县| 丰镇市| 河南省| 丹凤县| 清原| 宜城市| 科尔| 百色市| 大方县| 洛扎县| 金沙县| 沅陵县| 思南县| 衡阳市| 武汉市| 祁门县| 承德市| 泾源县| 平谷区| 定日县|