Note: This website is archived. For up-to-date information about D projects and development, please visit

Don't be intimidated. A lot is going on here but we can get through it, can't we? Thats right! Now, lets do this one line at a time.

Line 1

int main(char[][] args)

This is the signature of the function we are creating. Once we get past this things get easier. Lets look at all the pieces this gives us.

  • It returns a value of an int data type. What is that? An int is a number, we will cover simple data types in the next chapter. An easy way to remember the first thing you see is what is returned is to think about what do you want from a function.
  • It has the signature corresponding to the word main.
  • It takes a char[][] data type of arguments called args. What does char[][] mean? Well, brackets ( [] ) denote a set of elements called an array. A char is a character of text, like a letter. Together we are saying we have a set of sets of characters, or in other words, a set of words made of up characters.

Line 2


This says the upcoming code should all be grouped together until a matching ending brace is found ( } ).

Line 3

    writef("What is your name?");

Now we need to tell the user what we want so we display a prompt using this line of code that says: "What is your name?"

This is a function call. It means we are using some part of our program to do something with data we supply as arguments. We are calling the writef function from std.stdio in this case using the data "What is your name? ". Why is it called writef and not write? That is because you are writing formatted text with this function, to show this the f was added to the end. Also, write has a different meaning relating to streams that we can see later.

Line 4

    char[] name = chop(readln());

So, the next thing we need to do is get the user's name. To do this we are going to read a line of text from the console/terminal.

Two things are going on here. First we are making a variable. A variable is used to hold data while we perform operations in a program. The variable we are making is called name and it is a char[] data type variable. Remember, a char[] is just a set of characters.

Next we are using functions again. To be continued in the next few days.

Back: Your First Program