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

  • Learning D
  • Michael Parker
  • 222字
  • 2021-07-30 10:13:53

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
主站蜘蛛池模板: 辽源市| 阜南县| 丹棱县| 宝应县| 明光市| 修武县| 海盐县| 静海县| 中山市| 通化县| 南部县| 利川市| 南漳县| 广丰县| 卢龙县| 彭州市| 杭州市| 东城区| 凤凰县| 绩溪县| 陇川县| 海伦市| 清远市| 资阳市| 阜新市| 枝江市| 若羌县| 汤阴县| 策勒县| 仪征市| 新建县| 博爱县| 游戏| 金门县| 梁平县| 贵定县| 西乌| 乌什县| 和政县| 铁岭市| 壶关县|