Last Friday of each month: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 4,635: | Line 4,635: | ||
ENDDEFINE |
ENDDEFINE |
||
</lang> |
</lang> |
||
=={{header|Vlang}}== |
|||
<lang vlang>import time |
|||
import os |
|||
fn main() { |
|||
mut year := 0 |
|||
mut t := time.now() |
|||
year = os.input("Please select a year: ").int() |
|||
println("Last Fridays of each month of $year") |
|||
println("==================================") |
|||
for i in 1..13 { |
|||
mut j := time.month_days[i-1] |
|||
if i == 2 { |
|||
if time.is_leap_year(year) { |
|||
j = 29 |
|||
} |
|||
} |
|||
for { |
|||
t = time.parse('$year-${i:02}-$j 12:30:00')? |
|||
if t.weekday_str() == 'Fri' { |
|||
println("${time.long_months[i-1]}: $j") |
|||
break |
|||
} |
|||
j -- |
|||
} |
|||
} |
|||
}</lang> |
|||
{{out}} |
|||
<pre>Please select a year: 2012 |
|||
Last Fridays of each month of 2012 |
|||
================================== |
|||
January: 27 |
|||
February: 24 |
|||
March: 30 |
|||
April: 27 |
|||
May: 25 |
|||
June: 29 |
|||
July: 27 |
|||
August: 31 |
|||
September: 28 |
|||
October: 26 |
|||
November: 30 |
|||
December: 28 |
|||
</pre> |
|||
=={{header|Wren}}== |
=={{header|Wren}}== |