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

Using more than one function

Part of TutorialIntermediate


This D program shows you how to use more than one function in D.


    Multiple functions in D
    By B-man
    If you have any comments or questions e-mail me at

import std.stdio;

int main()       //main function
    char input_text[26];     //Create an array that will hold the input 
    writefln ("Now using the main() function");
    writef ("type somthing and press ENTER ");  
    scanf ("%*.s",input_text[25]);   //Scanf function. allows user input.

    function2();  //call the 'function2()' function
    return 0;  //don't return an error

int function2()  //function2() function
    writefln ("now using the function2() function");
    return 0; //don't return an error


Originally submitted by (Sat Feb 5, 2005 3:15 pm). Updated by Chris Sauls to use std.stdio (Mon Jan 2, 2006 11:40 pm).