better-enums/doc/tutorial/1-hello-world.md
2015-06-05 13:01:28 -05:00

617 B

Hello, World!

Download <a $download>enum.h, then build this program with it:

#include <iostream>
<em>#include "enum.h"</em>

<em>ENUM</em>(<em>Word</em>, <em>int</em>, <em>Hello</em>, <em>World</em>)

int main()
{
    std::cout << <em>(+Word::Hello)._to_string()</em> << ", "
              << <em>(+Word::World)._to_string()</em> << "!"
              << std::endl;

    return 0;
}

Run it, and you should see the output "Hello, World!"

Congratulations, you have just created your first Better Enum!

%% description = Introductory Better Enums tutorial.