RosettaCodeData/Task/Conditional-structures/D/conditional-structures-2.d
Ingy döt Net 764da6cbbb CDE
2013-04-10 16:57:12 -07:00

9 lines
202 B
D

auto i = 5;
// is(T: U) tests if T is implicitly castable to U.
// typeof(var) is the type of the variable.
// also: is(T==U) checks if T is U.
static if (is(typeof(i) : int)) {
...
} else {
...
}