On Friday, 5 April 2013 at 03:51:00 UTC, Chad Joan wrote:
There has to be a better way!
Please help.
Greetings,
Try a with statement:
http://dlang.org/statement.html#WithStatement
Another thing people commonly do is omit the "SANE_STATUS_"
prefix in the D declarations, instead using "SaneStatus." if
desired
So, with both, it could look something like this:
----
import std.stdio;
enum SaneStatus {
good = 0,
unsupported
}
void main(string[] args) {
auto status = SaneStatus.good;
with(SaneStatus) {
if(status == good)
writeln("Great!");
}
}
----
Hope this helps! :)