Find the last Sunday of each month: Difference between revisions

no edit summary
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
No edit summary
Line 3,662:
2013-11-24
2013-12-29</pre>
 
=={{header|Rust}}==
<lang rust>use std::env::args;
use time::{Date, Duration};
 
fn main() {
let year = args().nth(1).unwrap().parse::<i32>().unwrap();
(1..=12)
.map(|month| Date::try_from_ymd(year + month / 12, ((month % 12) + 1) as u8, 1))
.filter_map(|date| date.ok())
.for_each(|date| {
let days_back =
Duration::days(((date.weekday().number_from_sunday() as i64 + 5) % 7) + 1);
println!("{}", date - days_back);
});
}</lang>
{{out}}
<pre>
2013-01-27
2013-02-24
2013-03-31
2013-04-28
2013-05-26
2013-06-30
2013-07-28
2013-08-25
2013-09-29
2013-10-27
2013-11-24
2013-12-29
</pre>
 
=={{header|Scala}}==