D (programming language): Difference between revisions

Content deleted Content added
Line 68:
 
<syntaxhighlight lang="D">
ulong factorial(ulong n) {
if (n < 2)
{
if (n<2)
return 1;
else
Line 80 ⟶ 79:
 
<syntaxhighlight lang="D">
template Factorial(ulong n) {
static if (n < 2)
{
static if (n<2)
enum Factorial = 1;
else
Line 114 ⟶ 112:
import FooToD; // hypothetical module which contains a function that parses Foo source code
// and returns equivalent D code
void main() {
{
mixin(fooToD(import("example.foo")));
}