+ Reply to Thread
Results 1 to 7 of 7

Thread: [D] Hello World Tutorial

  1. #1
    Code Warrior Termana is a name known to all Termana is a name known to all Termana is a name known to all Termana is a name known to all Termana is a name known to all Termana is a name known to all Termana's Avatar
    Join Date
    Oct 2008
    Posts
    4,058
    Blog Entries
    6

    [D] Hello World Tutorial

    I am going to assume you have followed all the steps to my previous tutorial - "How to setup DMD"
    1. Open up a new text file.

    2. In the text file type:
    Code:
    import std.stdio;
    this will allow you access to the std.stdio module of the standard library, which is the standard input and output module.
    Code:
    int main()
    if you have past coding experience, you will know this is the starting point of the program.
    Code:
    {
    std.stdio.writefln("Hello World!");
    This writes the line "Hello World" to the console, for C or C++ coders, writefln is alot like printf, you can use it in the same way.
    Code:
    std.stdio.readln;
    return 0;
    }
    This will read the line inputted into the console, just makes it so that you have to press enter before the console window closes. And "return 0;" returns the function with the number 0. In the case of the main function, this just lets the OS know that the program has run sucessfully.

    3. Save the text file as helloworld.d in C:\ (or whatever your main drive is).

    4. Go to Start -> Run and type in cmd.

    5. At the command prompt type in "dmd -release -O -inline C:\helloworld.d"

    6. You can now run your Hello World program by going to My Computer -> C:\ and double clicking helloworld.exe

    In the code you can just use writefln and readln rather then std.stdio.writefln and std.stdio.readln, however I do like to use the whole name.
    My Site | Questions and Answers | Ask Me: Termana | Last Tutorial: Ajax innerHTML
    If you can keep your head while all around you are losing theirs, you probably have a CD writer on your desktop

  2. #2
    Administrator Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan's Avatar
    Join Date
    Nov 2005
    Location
    Hendersonville, NC
    Posts
    24,751
    Blog Entries
    97

    Re: [D] Hello World Tutorial

    Nice tutorial. The syntax looks just like C++. +rep

  3. #3
    Guru mendim. is a jewel in the rough mendim. is a jewel in the rough mendim. is a jewel in the rough mendim. is a jewel in the rough mendim.'s Avatar
    Join Date
    Nov 2008
    Location
    Kosovo.
    Posts
    2,394

    Re: [D] Hello World Tutorial

    Nice One Termana .. +rep .

  4. #4
    Programming Expert whitey6993 has a spectacular aura about whitey6993 has a spectacular aura about whitey6993's Avatar
    Join Date
    Dec 2008
    Posts
    433

    Re: [D] Hello World Tutorial

    Good tutorial. +rep

  5. #5
    Code Warrior Egz0N is a name known to all Egz0N is a name known to all Egz0N is a name known to all Egz0N is a name known to all Egz0N is a name known to all Egz0N is a name known to all Egz0N's Avatar
    Join Date
    Sep 2008
    Location
    Kosovo
    Age
    18
    Posts
    4,039

    Re: [D] Hello World Tutorial

    nice tutorial .. +rep

  6. #6
    Newbie amina is an unknown quantity at this point
    Join Date
    Jan 2009
    Posts
    4

    Re: [D] Hello World Tutorial

    Nice tutorial.Thanks for share it with us.its very nice of you to help some one else with your tutorial.I am waiting for your next post.Thanks again...

  7. #7
    Administrator Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan's Avatar
    Join Date
    Nov 2005
    Location
    Hendersonville, NC
    Posts
    24,751
    Blog Entries
    97

    Re: [D] Hello World Tutorial

    I'm curious - how did you come by and why did you choose to learn D?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Visual Studio 2008: C# Hello World Tutorial
    By Jordan in forum CSharp Tutorials
    Replies: 31
    Last Post: 07-02-2010, 04:00 PM
  2. Tutorial: C# Hello World
    By Jordan in forum CSharp Tutorials
    Replies: 15
    Last Post: 10-16-2008, 07:44 PM
  3. CodeCall Tutorial Contest #4
    By Jordan in forum Announcements
    Replies: 29
    Last Post: 02-25-2008, 09:25 AM
  4. John's Java Tutorial Index
    By John in forum Java Tutorials
    Replies: 0
    Last Post: 01-11-2007, 01:05 PM