Content deleted Content added
Updated D example |
→Example: Added detail |
||
Line 26:
</source>
Here's <source lang="D">
Line 40 ⟶ 41:
</source>
This example specifies a valid D function called "factorial" which would typically be evaluated at run time. The use of <code>const</code> tells the compiler that the initializer for the variables must be computed at compile time. Note that the arguments to the function must be constant as well.<ref>[http://www.digitalmars.com/d/1.0/attribute.html#const D 1.0 language specification: Attributes]</ref>
CTFE can be used to populate data structures at compile-time in a simple way (D version 2):
|