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:
this will allow you access to the std.stdio module of the standard library, which is the standard input and output module.Code:import std.stdio;
if you have past coding experience, you will know this is the starting point of the program.Code:int main()
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.writefln("Hello World!");
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.Code:std.stdio.readln; return 0; }
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!
Nice tutorial. The syntax looks just like C++. +rep
Nice One Termana .. +rep .![]()
Good tutorial. +rep
nice tutorial .. +rep![]()
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...
I'm curious - how did you come by and why did you choose to learn D?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks