Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.
Version 4 (modified by csauls, 18 years ago)
Goodbye, "Source."

Expressions

Part of TutorialFundamentals

Description

Demonstrates using mathematical expressions.

Example

import std.stdio;

void main() {
    int i, j;

    i = 12 * 12; /* multiplication */
    writefln("12 x 12 = ", i); /* i should be 144 */

    j = i / 8; /* division */
    writefln("144 / 8 = ", j); /* j should be 18 */

    i -= 44; /* same as saying "i = i - 44;" */
    writefln("144 - 44 = ", i); /* i should be 100 */
}