Example: Array of Integers in D
import std.stdio;
void main(string[ ] args) {
int scores[] = [188, 150, 210, 129];
writeln(scores[1]);
}
Output:
150
Example: Array of Integers in D Outputted with Loop
import std.stdio;
void main(string[ ] args) {
int scores[] = [188, 150, 210, 129];
for ( int j = 0; j < 4; j++ ) {
writeln("Score #", j+1,": ", scores[j]);
}
}
Output:
Score #1: 188
Score #2: 150
Score #3: 210
Score #4: 129