Day of the week: Difference between revisions

Content added Content deleted
(Updated D entry)
Line 488: Line 488:


void main() {
void main() {
writeln("Christmas comes on a Sunday in the years:");
"Christmas comes on a Sunday in the years:".writeln;
foreach (year; 2008 .. 2122) {
iota(2008, 2122)
immutable d = text(year) ~ "-Dec-25";
.filter!(y => Date.fromSimpleString(y.text ~ "-Dec-25").dayOfWeek ==
if (Date.fromSimpleString(d).dayOfWeek() == DayOfWeek.sun)
DayOfWeek.sun)
writeln(year);
.writeln;
}
}</lang>
}</lang>
{{out}}
{{out}}
<pre>Christmas comes on a Sunday in the years:
<pre>Christmas comes on a Sunday in the years:
[2011, 2016, 2022, 2033, 2039, 2044, 2050, 2061, 2067, 2072, 2078, 2089, 2095, 2101, 2107, 2112, 2118]</pre>
2011
2016
2022
2033
2039
2044
2050
2061
2067
2072
2078
2089
2095
2101
2107
2112
2118</pre>


=={{header|Delphi}}==
=={{header|Delphi}}==