<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.visual-prolog.com/index.php?action=history&amp;feed=atom&amp;title=Lessons%2FOutput_arguments</id>
	<title>Lessons/Output arguments - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.visual-prolog.com/index.php?action=history&amp;feed=atom&amp;title=Lessons%2FOutput_arguments"/>
	<link rel="alternate" type="text/html" href="https://wiki.visual-prolog.com/index.php?title=Lessons/Output_arguments&amp;action=history"/>
	<updated>2026-04-29T16:39:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://wiki.visual-prolog.com/index.php?title=Lessons/Output_arguments&amp;diff=4964&amp;oldid=prev</id>
		<title>Adam Rose: spelling mistake</title>
		<link rel="alternate" type="text/html" href="https://wiki.visual-prolog.com/index.php?title=Lessons/Output_arguments&amp;diff=4964&amp;oldid=prev"/>
		<updated>2024-10-11T07:41:55Z</updated>

		<summary type="html">&lt;p&gt;spelling mistake&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:41, 11 October 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the {{Lesson|Functions}} lesson we created a function, i.e. a predicate that &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;retruned &lt;/del&gt;a value.  Here we will look at output parameters, which is another way to let data flow outwards.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the {{Lesson|Functions}} lesson we created a function, i.e. a predicate that &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;returned &lt;/ins&gt;a value.  Here we will look at output parameters, which is another way to let data flow outwards.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Lessons/Exercise|Add this code to a console project:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Lessons/Exercise|Add this code to a console project:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Adam Rose</name></author>
	</entry>
	<entry>
		<id>https://wiki.visual-prolog.com/index.php?title=Lessons/Output_arguments&amp;diff=4711&amp;oldid=prev</id>
		<title>Jonas Sonn Jørgensen at 09:54, 5 February 2020</title>
		<link rel="alternate" type="text/html" href="https://wiki.visual-prolog.com/index.php?title=Lessons/Output_arguments&amp;diff=4711&amp;oldid=prev"/>
		<updated>2020-02-05T09:54:53Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 11:54, 5 February 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l21&quot;&gt;Line 21:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 21:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the clause body we call the function &amp;lt;vp&amp;gt;now&amp;lt;/vp&amp;gt; on the class &amp;lt;vp&amp;gt;time&amp;lt;/vp&amp;gt; this function returns a time &amp;#039;&amp;#039;object&amp;#039;&amp;#039; that represents the time the function was called.  Here we will not go into details about objects, but the next two lines of code shows that objects have predicates associated with them and that these are referenced these using a single colon: &amp;lt;vp&amp;gt;&amp;lt;object&amp;gt;:&amp;lt;predicate&amp;gt;&amp;lt;/vp&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the clause body we call the function &amp;lt;vp&amp;gt;now&amp;lt;/vp&amp;gt; on the class &amp;lt;vp&amp;gt;time&amp;lt;/vp&amp;gt; this function returns a time &amp;#039;&amp;#039;object&amp;#039;&amp;#039; that represents the time the function was called.  Here we will not go into details about objects, but the next two lines of code shows that objects have predicates associated with them and that these are referenced these using a single colon: &amp;lt;vp&amp;gt;&amp;lt;object&amp;gt;:&amp;lt;predicate&amp;gt;&amp;lt;/vp&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A &amp;lt;vp&amp;gt;time&amp;lt;/vp&amp;gt; object represents a time and date, and in the last two lines we &amp;quot;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;reqest&lt;/del&gt;&amp;quot; the date using the short format and the time formatted as a string.  What exactly these functions does depends on the users settings on the computer (i.e. the users locale settings).&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A &amp;lt;vp&amp;gt;time&amp;lt;/vp&amp;gt; object represents a time and date, and in the last two lines we &amp;quot;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;request&lt;/ins&gt;&amp;quot; the date using the short format and the time formatted as a string.  What exactly these functions does depends on the users settings on the computer (i.e. the users locale settings).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Lessons/Exercise|Update the run clause like this:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Lessons/Exercise|Update the run clause like this:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jonas Sonn Jørgensen</name></author>
	</entry>
	<entry>
		<id>https://wiki.visual-prolog.com/index.php?title=Lessons/Output_arguments&amp;diff=4710&amp;oldid=prev</id>
		<title>Jonas Sonn Jørgensen at 09:30, 5 February 2020</title>
		<link rel="alternate" type="text/html" href="https://wiki.visual-prolog.com/index.php?title=Lessons/Output_arguments&amp;diff=4710&amp;oldid=prev"/>
		<updated>2020-02-05T09:30:24Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 11:30, 5 February 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l17&quot;&gt;Line 17:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 17:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The first thing to notice here is the use of &amp;lt;vp&amp;gt;[out]&amp;lt;/vp&amp;gt; in the predicate declaration, this &amp;quot;mark&amp;quot; indicates that the corresponding argument is an output argument rather than an input argument.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The first thing to notice here is the use of &amp;lt;vp&amp;gt;[out]&amp;lt;/vp&amp;gt; in the predicate declaration, this &amp;quot;mark&amp;quot; indicates that the corresponding argument is an output argument rather than an input argument.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the clause we still have a &amp;quot;position&amp;quot; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;correcponding &lt;/del&gt;to that argument, but this time we have to &amp;quot;calculate&amp;quot; and return a value.  So in the clause above &amp;lt;vp&amp;gt;Date&amp;lt;/vp&amp;gt; and &amp;lt;vp&amp;gt;Time&amp;lt;/vp&amp;gt; does not have a value when the body starts to execute, it is our responsibility to create bind values to these variables.  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the clause we still have a &amp;quot;position&amp;quot; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;corresponding &lt;/ins&gt;to that argument, but this time we have to &amp;quot;calculate&amp;quot; and return a value.  So in the clause above &amp;lt;vp&amp;gt;Date&amp;lt;/vp&amp;gt; and &amp;lt;vp&amp;gt;Time&amp;lt;/vp&amp;gt; does not have a value when the body starts to execute, it is our responsibility to create bind values to these variables.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the clause body we call the function &amp;lt;vp&amp;gt;now&amp;lt;/vp&amp;gt; on the class &amp;lt;vp&amp;gt;time&amp;lt;/vp&amp;gt; this function returns a time &amp;#039;&amp;#039;object&amp;#039;&amp;#039; that represents the time the function was called.  Here we will not go into details about objects, but the next two lines of code shows that objects have predicates associated with them and that these are referenced these using a single colon: &amp;lt;vp&amp;gt;&amp;lt;object&amp;gt;:&amp;lt;predicate&amp;gt;&amp;lt;/vp&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the clause body we call the function &amp;lt;vp&amp;gt;now&amp;lt;/vp&amp;gt; on the class &amp;lt;vp&amp;gt;time&amp;lt;/vp&amp;gt; this function returns a time &amp;#039;&amp;#039;object&amp;#039;&amp;#039; that represents the time the function was called.  Here we will not go into details about objects, but the next two lines of code shows that objects have predicates associated with them and that these are referenced these using a single colon: &amp;lt;vp&amp;gt;&amp;lt;object&amp;gt;:&amp;lt;predicate&amp;gt;&amp;lt;/vp&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jonas Sonn Jørgensen</name></author>
	</entry>
	<entry>
		<id>https://wiki.visual-prolog.com/index.php?title=Lessons/Output_arguments&amp;diff=4709&amp;oldid=prev</id>
		<title>Jonas Sonn Jørgensen at 09:30, 5 February 2020</title>
		<link rel="alternate" type="text/html" href="https://wiki.visual-prolog.com/index.php?title=Lessons/Output_arguments&amp;diff=4709&amp;oldid=prev"/>
		<updated>2020-02-05T09:30:00Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 11:30, 5 February 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l17&quot;&gt;Line 17:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 17:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The first thing to notice here is the use of &amp;lt;vp&amp;gt;[out]&amp;lt;/vp&amp;gt; in the predicate declaration, this &amp;quot;mark&amp;quot; indicates that the corresponding argument is an output argument rather than an input argument.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The first thing to notice here is the use of &amp;lt;vp&amp;gt;[out]&amp;lt;/vp&amp;gt; in the predicate declaration, this &amp;quot;mark&amp;quot; indicates that the corresponding argument is an output argument rather than an input argument.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the clause we still have &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;an &lt;/del&gt;&amp;quot;position&amp;quot; correcponding to that argument, but this time we have to &amp;quot;calculate&amp;quot; and return a value.  So in the clause above &amp;lt;vp&amp;gt;Date&amp;lt;/vp&amp;gt; and &amp;lt;vp&amp;gt;Time&amp;lt;/vp&amp;gt; does not have a value when the body starts to execute, it is our responsibility to create bind values to these variables.  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the clause we still have &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;a &lt;/ins&gt;&amp;quot;position&amp;quot; correcponding to that argument, but this time we have to &amp;quot;calculate&amp;quot; and return a value.  So in the clause above &amp;lt;vp&amp;gt;Date&amp;lt;/vp&amp;gt; and &amp;lt;vp&amp;gt;Time&amp;lt;/vp&amp;gt; does not have a value when the body starts to execute, it is our responsibility to create bind values to these variables.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the clause body we call the function &amp;lt;vp&amp;gt;now&amp;lt;/vp&amp;gt; on the class &amp;lt;vp&amp;gt;time&amp;lt;/vp&amp;gt; this function returns a time &amp;#039;&amp;#039;object&amp;#039;&amp;#039; that represents the time the function was called.  Here we will not go into details about objects, but the next two lines of code shows that objects have predicates associated with them and that these are referenced these using a single colon: &amp;lt;vp&amp;gt;&amp;lt;object&amp;gt;:&amp;lt;predicate&amp;gt;&amp;lt;/vp&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the clause body we call the function &amp;lt;vp&amp;gt;now&amp;lt;/vp&amp;gt; on the class &amp;lt;vp&amp;gt;time&amp;lt;/vp&amp;gt; this function returns a time &amp;#039;&amp;#039;object&amp;#039;&amp;#039; that represents the time the function was called.  Here we will not go into details about objects, but the next two lines of code shows that objects have predicates associated with them and that these are referenced these using a single colon: &amp;lt;vp&amp;gt;&amp;lt;object&amp;gt;:&amp;lt;predicate&amp;gt;&amp;lt;/vp&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jonas Sonn Jørgensen</name></author>
	</entry>
	<entry>
		<id>https://wiki.visual-prolog.com/index.php?title=Lessons/Output_arguments&amp;diff=4510&amp;oldid=prev</id>
		<title>Thomas Linder Puls: Less backreference</title>
		<link rel="alternate" type="text/html" href="https://wiki.visual-prolog.com/index.php?title=Lessons/Output_arguments&amp;diff=4510&amp;oldid=prev"/>
		<updated>2018-09-26T08:54:22Z</updated>

		<summary type="html">&lt;p&gt;Less backreference&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:54, 26 September 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the {{Lesson|Functions}} lesson we created a function, i.e. a predicate that retruned a value.  Here we will look at output parameters, which is another way to let data flow outwards.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the {{Lesson|Functions}} lesson we created a function, i.e. a predicate that retruned a value.  Here we will look at output parameters, which is another way to let data flow outwards.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Lessons/Exercise|Add this code to &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;your {{Lesson|Functions}} &lt;/del&gt;project:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Lessons/Exercise|Add this code to &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;a console &lt;/ins&gt;project:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;vip&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;vip&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Thomas Linder Puls</name></author>
	</entry>
	<entry>
		<id>https://wiki.visual-prolog.com/index.php?title=Lessons/Output_arguments&amp;diff=4508&amp;oldid=prev</id>
		<title>Thomas Linder Puls: initial</title>
		<link rel="alternate" type="text/html" href="https://wiki.visual-prolog.com/index.php?title=Lessons/Output_arguments&amp;diff=4508&amp;oldid=prev"/>
		<updated>2018-09-25T16:43:54Z</updated>

		<summary type="html">&lt;p&gt;initial&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;In the {{Lesson|Functions}} lesson we created a function, i.e. a predicate that retruned a value.  Here we will look at output parameters, which is another way to let data flow outwards.&lt;br /&gt;
&lt;br /&gt;
{{Lessons/Exercise|Add this code to your {{Lesson|Functions}} project:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;vip&amp;gt;&lt;br /&gt;
class predicates&lt;br /&gt;
    nowDateAndTime : (string Date [out], string Time [out]).&lt;br /&gt;
clauses&lt;br /&gt;
    nowDateAndTime(Date, Time) :-&lt;br /&gt;
        Now = time::now(),&lt;br /&gt;
        Date = Now:formatShortDate(),&lt;br /&gt;
        Time = Now:formatTime().&lt;br /&gt;
&amp;lt;/vip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Build the project, and answer &amp;quot;Yes&amp;quot; to adding the &amp;#039;&amp;#039;&amp;#039;...time.ph&amp;#039;&amp;#039;&amp;#039; include statement.}}&lt;br /&gt;
&lt;br /&gt;
The first thing to notice here is the use of &amp;lt;vp&amp;gt;[out]&amp;lt;/vp&amp;gt; in the predicate declaration, this &amp;quot;mark&amp;quot; indicates that the corresponding argument is an output argument rather than an input argument.&lt;br /&gt;
&lt;br /&gt;
In the clause we still have an &amp;quot;position&amp;quot; correcponding to that argument, but this time we have to &amp;quot;calculate&amp;quot; and return a value.  So in the clause above &amp;lt;vp&amp;gt;Date&amp;lt;/vp&amp;gt; and &amp;lt;vp&amp;gt;Time&amp;lt;/vp&amp;gt; does not have a value when the body starts to execute, it is our responsibility to create bind values to these variables. &lt;br /&gt;
&lt;br /&gt;
In the clause body we call the function &amp;lt;vp&amp;gt;now&amp;lt;/vp&amp;gt; on the class &amp;lt;vp&amp;gt;time&amp;lt;/vp&amp;gt; this function returns a time &amp;#039;&amp;#039;object&amp;#039;&amp;#039; that represents the time the function was called.  Here we will not go into details about objects, but the next two lines of code shows that objects have predicates associated with them and that these are referenced these using a single colon: &amp;lt;vp&amp;gt;&amp;lt;object&amp;gt;:&amp;lt;predicate&amp;gt;&amp;lt;/vp&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;vp&amp;gt;time&amp;lt;/vp&amp;gt; object represents a time and date, and in the last two lines we &amp;quot;reqest&amp;quot; the date using the short format and the time formatted as a string.  What exactly these functions does depends on the users settings on the computer (i.e. the users locale settings).&lt;br /&gt;
&lt;br /&gt;
{{Lessons/Exercise|Update the run clause like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;vip&amp;gt;&lt;br /&gt;
clauses&lt;br /&gt;
    run() :-&lt;br /&gt;
        nowDateAndTime(NowDate, NowTime),&lt;br /&gt;
        stdio::writef(&amp;quot;The time is now % and it is the %.\n&amp;quot;, NowTime, NowDate).&lt;br /&gt;
&amp;lt;/vip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run the project.}}&lt;br /&gt;
&lt;br /&gt;
Sometimes you will accidentally use a single colon where you intended to use two and vice versa:&lt;br /&gt;
&lt;br /&gt;
{{Lessons/Exercise|Try using a single colon instead of two and build the project and examine the error message.  Revert the problem and try the the opposite error.  End without errors.}}&lt;br /&gt;
&lt;br /&gt;
Output arguments can also be used in functions, and together with input arguments.&lt;br /&gt;
&lt;br /&gt;
{{Lessons/Exercise|Update &amp;lt;vp&amp;gt;nowDateAndTime&amp;lt;/vp&amp;gt; to be a &amp;#039;&amp;#039;&amp;#039;function&amp;#039;&amp;#039;&amp;#039; that returns the date as an output argument and the time as the function return value.&lt;br /&gt;
&lt;br /&gt;
Notice the error message you get if you don&amp;#039;t update the call in the &amp;lt;vp&amp;gt;run&amp;lt;/vp&amp;gt; clause.&lt;br /&gt;
&lt;br /&gt;
Also update the &amp;lt;vp&amp;gt;run&amp;lt;/vp&amp;gt; clause and run the program.}}&lt;br /&gt;
&lt;br /&gt;
Summary:&lt;br /&gt;
&lt;br /&gt;
* Output arguments are declared using the &amp;lt;vp&amp;gt;[out]&amp;lt;/vp&amp;gt; attribute.&lt;br /&gt;
* An output argument is unbound when the clause &amp;lt;vp&amp;gt;&amp;lt;body&amp;gt;&amp;lt;/vp&amp;gt; is entered and must be bound when the predicate returns.&lt;br /&gt;
* There is something called objects.&lt;br /&gt;
* Objects are values that can be passed around and held in variables.&lt;br /&gt;
* Objects have predicates associated and these are referenced with single colon: &amp;lt;vp&amp;gt;&amp;lt;object&amp;gt;:&amp;lt;predicate&amp;gt;&amp;lt;/vp&amp;gt; (predicates in classes are referenced using a double-colon).&lt;br /&gt;
&lt;br /&gt;
[[Category:Lessons|{{SUBPAGENAME}}]]&lt;/div&gt;</summary>
		<author><name>Thomas Linder Puls</name></author>
	</entry>
</feed>