== Learning D - D File Structure == ---- === Summary === ---- D's file structure resembles a mix of Java and C++ files. It follows this pattern: 1. [#ScriptLine Script Line] 1. [#Imports Imports] 1. [#Code Code] === Script Line === ---- For all those Posix users include this line for easy running of your files. {{{ #!/usr/bin/dmd -run }}} === Imports === ---- Imports a little different in D than Java and C++ so look out. One important thing is that D uses modules of code, not packages. Phobos, the standard library, has kept the std naming convention though, which is quite nice.[[BR]] To import a module simply write a comma separated list following the import statement: {{{ import std.stdio, std.thread; }}} To import a specific part of a module use a colon after the module name and use commas to separate the parts you want: {{{ import std.stdio : writef, readln; }}} Since these two formats of importing both use comma separated list in different ways it is bad form to combine them. === Code === ---- After the 2 steps above put all your functions, variables, and extern calls here. Like many other programming languages D uses a "main" function to tell where to start executing a program. ---- [wiki:LearningD-YourFirstProgram Next: Your First Program]