Anonymous user
Last Friday of each month: Difference between revisions
m
→{{header|Nanoquery}}
mNo edit summary |
|||
Line 2,142:
=={{header|Nanoquery}}==
<lang Nanoquery>import Nanoquery.Util
// a function to check if a year is a leap year
def isLeapYear(
if (
return (
else
return (
end
end
// a function to format 1-digit numbers as "0x"
def
if (
return str(
else
return "0" + str(
end
end
// get a year from the console
print "enter year: "
// build a list of the expected amount of days for each month
if isLeapYear($year)
end
▲append $days 31 30 31 30 31 31 30 31 30 31
// loop through each month
for
// loop through each day of the month
for
// create a date object for this date
// check if it's a friday
if (
// if it is, keep it
end
end for
// display the last friday found
print
print
println
end</lang>
|