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

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
主站蜘蛛池模板: 义乌市| 开封县| 台中市| 玉田县| 屯留县| 若尔盖县| 岳阳县| 抚顺县| 山东| 湖州市| 平罗县| 龙井市| 西华县| 寻甸| 哈尔滨市| 丰顺县| 大兴区| 寿光市| 米林县| 伊通| 全南县| 南川市| 名山县| 灵台县| 桃园县| 库尔勒市| 裕民县| 楚雄市| 黄陵县| 纳雍县| 晋江市| 九江市| 内乡县| 大悟县| 龙南县| 榆树市| 清河县| 克拉玛依市| 合川市| 宁国市| 湘西|