+ Reply to Thread
Results 1 to 7 of 7

Thread: [D] Hello World Tutorial

  1. #1
    Join Date
    Oct 2008
    Posts
    4,060
    Blog Entries
    6
    Rep Power
    45

    [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.
    Interested in participating in community events?
    Want to harness your programming skill and turn it into absolute prowess?
    Come join our programming events!

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Jordan Guest

    Re: [D] Hello World Tutorial

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

  4. #3
    Join Date
    Nov 2008
    Location
    Kosovo.
    Posts
    2,391
    Rep Power
    30

    Re: [D] Hello World Tutorial

    Nice One Termana .. +rep .

  5. #4
    whitey6993's Avatar
    whitey6993 is offline Programming Expert
    Join Date
    Dec 2008
    Posts
    435
    Rep Power
    15

    Re: [D] Hello World Tutorial

    Good tutorial. +rep

  6. #5
    Join Date
    Sep 2008
    Location
    Kosovo
    Posts
    4,032
    Rep Power
    44

    Re: [D] Hello World Tutorial

    nice tutorial .. +rep

  7. #6
    amina is offline Newbie
    Join Date
    Jan 2009
    Posts
    4
    Rep Power
    0

    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...

  8. #7
    Jordan Guest

    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. Replies: 9
    Last Post: 01-14-2011, 12:59 PM
  2. Visual Studio 2008: C# Hello World Tutorial
    By Jordan in forum CSharp Tutorials
    Replies: 32
    Last Post: 07-30-2010, 07:15 AM
  3. C/C++ Hello World Tutorial
    By Khaotic in forum C Tutorials
    Replies: 6
    Last Post: 07-28-2009, 08:35 AM
  4. Java:Tutorial - "Hello World"
    By John in forum Java Tutorials
    Replies: 20
    Last Post: 12-23-2008, 06:52 PM
  5. Tutorial: C# Hello World
    By Jordan in forum CSharp Tutorials
    Replies: 15
    Last Post: 10-16-2008, 08:44 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts