aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ext_depends/D-YAML/examples/getting_started/main.d
blob: 2cc242c9254d10035164693b1b7928a29d051e27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import std.stdio;
import dyaml;

void main()
{
    //Read the input.
    Node root = Loader.fromFile("input.yaml").load();

    //Display the data read.
    foreach(string word; root["Hello World"])
    {
        writeln(word);
    }
    writeln("The answer is ", root["Answer"].as!int);

    //Dump the loaded document to output.yaml.
    dumper().dump(File("output.yaml", "w").lockingTextWriter, root);
}