Fibonacci Sequence - D Typing CST Test
Loading…
Fibonacci Sequence — D Code
Generates first 10 Fibonacci numbers.
import std.stdio;
int fib(int n) {
return n < 2 ? n : fib(n - 1) + fib(n - 2);
}
void main() {
foreach(i; 0 .. 10)
writeln(fib(i));
}D Language Guide
D is a high-level, statically typed, compiled systems programming language combining C-like performance with modern features like garbage collection, functional programming, and meta-programming.
Primary Use Cases
- ▸Systems programming and OS-level development
- ▸High-performance computing
- ▸Game engines and graphics programming
- ▸Financial and trading applications
- ▸Compile-time code generation and metaprogramming
Notable Features
- ▸C-like syntax familiar to C/C++ developers
- ▸Garbage-collected memory with optional manual management
- ▸Templates, mixins, and compile-time function execution
- ▸Contracts, unit tests, and range-based algorithms
- ▸Cross-platform compilation with high performance
Origin & Creator
Created by Walter Bright in 1999, later developed with contributions from Andrei Alexandrescu.
Industrial Note
D is used in performance-critical applications, game engines, high-performance computing, and financial software requiring fast, reliable code.