Last Friday of each month: Difference between revisions

(Added Rebol code)
Line 1,345:
 
=={{header|REBOL}}==
The longer version:
<lang REBOL>leap-year?: function [year] [to-logic attempt [to-date reduce [29 2 year]]]
 
Line 1,383 ⟶ 1,384:
28-Dec-2012
</pre>
A shorter version:
NB. See "Find the last Sunday of each month" Rosetta for alternative (more succint) solution
<lang REBOL>last-fridays-of-year: function [year] [
collect [
repeat month 12 [
d: to-date reduce [1 month year]
d/month: d/month + 1 ; start of next month
until [d/day: d/day - 1 d/weekday = 5] ; go backwards until find a Friday
keep d
]
]
]
 
foreach friday last-fridays-of-year to-integer input [print friday]
</lang>
NB. See "Find the last Sunday of each month" Rosetta for alternative (even more succintsuccinct) solution
 
=={{header|REXX}}==
Anonymous user