summaryrefslogtreecommitdiffhomepage
path: root/d.html.markdown
diff options
context:
space:
mode:
Diffstat (limited to 'd.html.markdown')
-rw-r--r--d.html.markdown14
1 files changed, 7 insertions, 7 deletions
diff --git a/d.html.markdown b/d.html.markdown
index 80c1dc65..9ebba385 100644
--- a/d.html.markdown
+++ b/d.html.markdown
@@ -53,15 +53,15 @@ void main() {
// For and while are nice, but in D-land we prefer 'foreach' loops.
// The '..' creates a continuous range, including the first value
// but excluding the last.
- foreach(i; 1..1_000_000) {
+ foreach(n; 1..1_000_000) {
if(n % 2 == 0)
- writeln(i);
+ writeln(n);
}
// There's also 'foreach_reverse' when you want to loop backwards.
- foreach_reverse(i; 1..int.max) {
+ foreach_reverse(n; 1..int.max) {
if(n % 2 == 1) {
- writeln(i);
+ writeln(n);
} else {
writeln("No!");
}
@@ -199,8 +199,8 @@ our getter and setter methods, and keep the clean syntax of
accessing members directly!
Other object-oriented goodies at our disposal
-include `interface`s, `abstract class`es,
-and `override`ing methods. D does inheritance just like Java:
+include interfaces, abstract classes,
+and overriding methods. D does inheritance just like Java:
Extend one class, implement as many interfaces as you please.
We've seen D's OOP facilities, but let's switch gears. D offers
@@ -247,7 +247,7 @@ void main() {
// and take advantage of as many cores as we have available.
auto arr = new double[1_000_000];
- // Use an index, and an array element by referece,
+ // Use an index, and an array element by reference,
// and just call parallel on the array!
foreach(i, ref elem; parallel(arr)) {
ref = sqrt(i + 1.0);