XCODX |

D Online Compiler & Interpreter

Select Language
Online Code Compiler
Full HTML IDE
Py main.py
Program Output Ready
  Welcome to XCODX Online Compiler

  Quick Start:
  Ctrl+Enter  Run code
  Ctrl+S      Save / Download
  Ctrl+L      Clear output

  Select a language and start coding.
Success
Operation completed

About D

D is Walter Bright's answer to C++: a compiled systems language with garbage collection you can opt out of, built-in unit tests, contracts, and compile-time function execution that predates most of the industry's metaprogramming trends. First released in 2001 and now maintained alongside the DMD, LDC, and GDC compilers, D runs in production at Weka.io, whose high-performance filesystem is written in it, and at Symmetry Investments. The syntax is immediately readable to anyone who knows C, Java, or C#. This page gives you a live D terminal in the browser: your code compiles and runs on a real process, and readln waits for input you type directly into the streaming output.

Hello World in D

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;

void main()
{
    write("Enter your name: ");
    string name = strip(readln());
    writeln("Hello, ", name, "!");

    write("Enter a limit: ");
    int limit = strip(readln()).to!int;

    auto evens = iota(1, limit + 1).filter!(n => n % 2 == 0);
    writeln("Even numbers up to ", limit, ": ", evens);

    foreach (i; 1 .. 4)
        writeln(i, " cubed is ", i * i * i);
}

When to use D

D suits developers who want C++-class performance with faster compile times and cleaner generics, which is why it appears in high-throughput storage systems like Weka.io and in quantitative finance at Symmetry Investments. Students use it to study ranges and lazy evaluation, since std.algorithm chains like filter and map compose without allocations. It is also a practical scripting replacement: rdmd-style quick programs handle text processing with compiled speed, and C programmers exploring safer features test slices, immutability, and built-in unittest blocks here.

Common questions

Can I type input into readln while my D program runs?

Yes. This is a real terminal session, so readln() blocks the process until you respond. Combine it with std.string.strip to drop the trailing newline and std.conv.to!int for numeric parsing, and you can build interactive menus, quizzes, and step-by-step console programs exactly as you would in a local shell.

Which D compiler does the online environment use?

Your code is built with the reference DMD compiler toolchain, which compiles quickly and supports the full language including templates, mixins, and compile-time function execution. For maximum optimized speed developers locally often switch to LDC, but for learning, testing snippets, and coursework DMD's behavior is identical where it matters.

Are dub packages or multiple modules supported?

No. The sandbox compiles a single self-contained file, so dub dependencies and multi-module projects will not resolve. Phobos, D's standard library, ships with the compiler and includes std.algorithm, std.range, std.regex, std.json, and std.parallelism, which is more than enough for algorithm practice, language exploration, and most university assignments.

How D runs on XCODX

Sandbox filename
main.d
Entry point
single main source file
Editor grammar
d
Reading stdin
readln()
Input delivery
live WebSocket stream
Prompt flushing
flush manually before reading input
Compile limit
10 s
Run limit
3 s batch · up to 3 min live
Memory
256 MB per stage
Max source
50,000 characters

Default program on this page

import std.stdio;
void main() {
    writeln("Hello from D!");
    writeln("Welcome to XCODX Online Compiler!");
    string message = "D is awesome!";
    writeln(message);
}