<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://miniscript.org/w/index.php?action=history&amp;feed=atom&amp;title=Outer</id>
	<title>Outer - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://miniscript.org/w/index.php?action=history&amp;feed=atom&amp;title=Outer"/>
	<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Outer&amp;action=history"/>
	<updated>2026-05-01T16:20:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.0</generator>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Outer&amp;diff=1014&amp;oldid=prev</id>
		<title>JoeStrout at 13:37, 29 October 2022</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Outer&amp;diff=1014&amp;oldid=prev"/>
		<updated>2022-10-29T13:37:45Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&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: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 13:37, 29 October 2022&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='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;The &amp;lt;c&amp;gt;outer&amp;lt;/c&amp;gt; intrinsic function gets a reference to the variables of the enclosing scope.  In the case of nested functions, it's the variables local to the function in which &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;c&amp;gt;outer&amp;lt;/c&amp;gt; is called&lt;/del&gt;.  In an [[import]] module, it can be used to access the module scope (similar to &amp;quot;file scope&amp;quot; in some other languages).  If called in an ordinary, non-nested function defined at the global scope, then &amp;lt;c&amp;gt;outer&amp;lt;/c&amp;gt; is equivalent to &amp;lt;c&amp;gt;[[globals]]&amp;lt;/c&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;The &amp;lt;c&amp;gt;outer&amp;lt;/c&amp;gt; intrinsic function gets a reference to the variables of the enclosing scope.  In the case of nested functions, it's the variables local to the function in which &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the nested function was defined&lt;/ins&gt;.  In an [[import]] module, it can be used to access the module scope (similar to &amp;quot;file scope&amp;quot; in some other languages).  If called in an ordinary, non-nested function defined at the global scope, then &amp;lt;c&amp;gt;outer&amp;lt;/c&amp;gt; is equivalent to &amp;lt;c&amp;gt;[[globals]]&amp;lt;/c&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;See also: [[globals]]; [[locals]].&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;See also: [[globals]]; [[locals]].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Outer&amp;diff=807&amp;oldid=prev</id>
		<title>JoeStrout: fixed formatting problems and bug in example code</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Outer&amp;diff=807&amp;oldid=prev"/>
		<updated>2021-10-05T19:34:10Z</updated>

		<summary type="html">&lt;p&gt;fixed formatting problems and bug in example code&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&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: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 19:34, 5 October 2021&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='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;The &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/del&gt;outer&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;''' &lt;/del&gt;intrinsic function gets a reference to the variables of the enclosing scope.  In the case of nested functions, it's the variables local to the function in which &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/del&gt;outer&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'' &lt;/del&gt;is called.  In an [[import]] module, it can be used to access the module scope (similar to &amp;quot;file scope&amp;quot; in some other languages).  If called in an ordinary, non-nested function defined at the global scope, then &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/del&gt;outer&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;''' &lt;/del&gt;is equivalent to &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/del&gt;[[globals]]&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;The &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;c&amp;gt;&lt;/ins&gt;outer&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/c&amp;gt; &lt;/ins&gt;intrinsic function gets a reference to the variables of the enclosing scope.  In the case of nested functions, it's the variables local to the function in which &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;c&amp;gt;&lt;/ins&gt;outer&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/c&amp;gt; &lt;/ins&gt;is called.  In an [[import]] module, it can be used to access the module scope (similar to &amp;quot;file scope&amp;quot; in some other languages).  If called in an ordinary, non-nested function defined at the global scope, then &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;c&amp;gt;&lt;/ins&gt;outer&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/c&amp;gt; &lt;/ins&gt;is equivalent to &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;c&amp;gt;&lt;/ins&gt;[[globals]]&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/c&amp;gt;&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;See also: [[globals]]; [[locals]].&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;See also: [[globals]]; [[locals]].&lt;/div&gt;&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-l5&quot; &gt;Line 5:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 5:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;== Example ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;== Example ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;Many of the modules in &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/del&gt;/sys/lib&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;''' &lt;/del&gt;run unit tests.  The &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;```&lt;/del&gt;runUnitTests&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;``` &lt;/del&gt;function defines several a helper function, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;```&lt;/del&gt;assertEqual&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;``` &lt;/del&gt;inside it.  This function checks for errors, but also needs to maintain an error count across calls.  So it uses &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/del&gt;outer&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;''' &lt;/del&gt;to update an error count defined at the level of the enclosing function, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;```&lt;/del&gt;runUnitTests&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;```&lt;/del&gt;:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;Many of the modules in &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;c&amp;gt;&lt;/ins&gt;/sys/lib&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/c&amp;gt; &lt;/ins&gt;run unit tests.  The &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;c&amp;gt;&lt;/ins&gt;runUnitTests&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/c&amp;gt; &lt;/ins&gt;function defines several a helper function, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;c&amp;gt;&lt;/ins&gt;assertEqual&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/c&amp;gt; &lt;/ins&gt;inside it.  This function checks for errors, but also needs to maintain an error count across calls.  So it uses &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;c&amp;gt;&lt;/ins&gt;outer&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/c&amp;gt; &lt;/ins&gt;to update an error count defined at the level of the enclosing function, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;c&amp;gt;&lt;/ins&gt;runUnitTests&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/c&amp;gt;&lt;/ins&gt;:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;ms&amp;gt;runUnitTests = function()&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;ms&amp;gt;runUnitTests = function()&lt;/div&gt;&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-l11&quot; &gt;Line 11:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 11:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;     assertEqual = function(actual, expected)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;     assertEqual = function(actual, expected)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;         if actual != expected then&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;         if actual != expected then&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;             print &amp;quot;Unit test failure &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;(&amp;quot; + testing + &amp;quot;)&lt;/del&gt;: expected &amp;quot; + expected + &amp;quot;, got &amp;quot; + actual&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;             print &amp;quot;Unit test failure: expected &amp;quot; + expected + &amp;quot;, got &amp;quot; + actual&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;             outer.errorCount = errorCount + 1&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;             outer.errorCount = errorCount + 1&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;         end if&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;         end if&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Outer&amp;diff=528&amp;oldid=prev</id>
		<title>JoeStrout: Created page with &quot;The '''outer''' intrinsic function gets a reference to the variables of the enclosing scope.  In the case of nested functions, it's the variables local to the function in whic...&quot;</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Outer&amp;diff=528&amp;oldid=prev"/>
		<updated>2020-06-03T15:32:03Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;The &amp;#039;&amp;#039;&amp;#039;outer&amp;#039;&amp;#039;&amp;#039; intrinsic function gets a reference to the variables of the enclosing scope.  In the case of nested functions, it&amp;#039;s the variables local to the function in whic...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The '''outer''' intrinsic function gets a reference to the variables of the enclosing scope.  In the case of nested functions, it's the variables local to the function in which '''outer'' is called.  In an [[import]] module, it can be used to access the module scope (similar to &amp;quot;file scope&amp;quot; in some other languages).  If called in an ordinary, non-nested function defined at the global scope, then '''outer''' is equivalent to '''[[globals]]'''.&lt;br /&gt;
&lt;br /&gt;
See also: [[globals]]; [[locals]].&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
Many of the modules in '''/sys/lib''' run unit tests.  The ```runUnitTests``` function defines several a helper function, ```assertEqual``` inside it.  This function checks for errors, but also needs to maintain an error count across calls.  So it uses '''outer''' to update an error count defined at the level of the enclosing function, ```runUnitTests```:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;runUnitTests = function()&lt;br /&gt;
    errorCount = 0&lt;br /&gt;
    assertEqual = function(actual, expected)&lt;br /&gt;
        if actual != expected then&lt;br /&gt;
            print &amp;quot;Unit test failure (&amp;quot; + testing + &amp;quot;): expected &amp;quot; + expected + &amp;quot;, got &amp;quot; + actual&lt;br /&gt;
            outer.errorCount = errorCount + 1&lt;br /&gt;
        end if&lt;br /&gt;
    end function&lt;br /&gt;
&lt;br /&gt;
    assertEqual 2+2, 5&lt;br /&gt;
end function&lt;br /&gt;
runUnitTests&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Language]]&lt;br /&gt;
[[Category:Intrinsic Functions]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
</feed>