Last Friday of each month: Difference between revisions

Content added Content deleted
No edit summary
(→‎{{header|Picat}}: Split into subsections.)
Line 3,202: Line 3,202:
Year mod 400 == 0. </lang>
Year mod 400 == 0. </lang>


===Running the program===
There are several ways to run this program; let's call it "last_friday_of_each_month.pi":
There are several ways to run this program; let's call it "last_friday_of_each_month.pi":


From Picat's shell:
===From Picat's shell===
<pre>
<pre>$ picat
$ picat
Picat> cl(last_friday_of_each_month)
Picat> cl(last_friday_of_each_month)
Picat> show_year(2022)
Picat> show_year(2022)
Line 3,220: Line 3,220:
2022-10-28
2022-10-28
2022-11-25
2022-11-25
2022-12-30
2022-12-30</pre>
</pre>


From the command line:
===From the command line, year as parameter===
Via <code>main(ARGV)</code>.

* With the year as a parameter, via main(ARGV):
<pre>$ picat last_friday_of_each_month.pi 2022</pre>
<pre>$ picat last_friday_of_each_month.pi 2022</pre>


* As a goal:
===From the command line, as a goal===
<pre>$ picat -g "show_year(2022)" last_friday_of_each_month.pi</pre>
<pre>$ picat -g "show_year(2022)" last_friday_of_each_month.pi</pre>


* Run the default goal (go/0):
===Run the default goal (go/0))===
<pre>$ picat last_friday_of_each_month.pi</pre>
<pre>$ picat last_friday_of_each_month.pi</pre>



=={{header|PicoLisp}}==
=={{header|PicoLisp}}==