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

Using more than one function

Part of TutorialIntermediate

Description

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

Example

/*
    Multiple functions in D
    By B-man
    If you have any comments or questions e-mail me at
    bman_099@yahoo.com
*/

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
}

Source

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