<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
		<id>https://zh-cn.arcowiki.com/index.php?action=history&amp;feed=atom&amp;title=%E5%AE%8F%E4%B8%AD%E7%9A%84%E5%85%A8%E5%B1%80%E5%92%8C%E5%B1%80%E9%83%A8%E5%8F%98%E9%87%8F</id>
		<title>宏中的全局和局部变量 - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="https://zh-cn.arcowiki.com/index.php?action=history&amp;feed=atom&amp;title=%E5%AE%8F%E4%B8%AD%E7%9A%84%E5%85%A8%E5%B1%80%E5%92%8C%E5%B1%80%E9%83%A8%E5%8F%98%E9%87%8F"/>
		<link rel="alternate" type="text/html" href="https://zh-cn.arcowiki.com/index.php?title=%E5%AE%8F%E4%B8%AD%E7%9A%84%E5%85%A8%E5%B1%80%E5%92%8C%E5%B1%80%E9%83%A8%E5%8F%98%E9%87%8F&amp;action=history"/>
		<updated>2026-04-11T05:21:36Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.29.1</generator>

	<entry>
		<id>https://zh-cn.arcowiki.com/index.php?title=%E5%AE%8F%E4%B8%AD%E7%9A%84%E5%85%A8%E5%B1%80%E5%92%8C%E5%B1%80%E9%83%A8%E5%8F%98%E9%87%8F&amp;diff=118&amp;oldid=prev</id>
		<title>Slia：创建页面，内容为“The Declaration of A VariableVariables declaration in a Macro can be GLOBAL or LOCAL.  == Global Declaration == The &lt;code&gt;GLOBAL&lt;/code&gt; modifier in the […”</title>
		<link rel="alternate" type="text/html" href="https://zh-cn.arcowiki.com/index.php?title=%E5%AE%8F%E4%B8%AD%E7%9A%84%E5%85%A8%E5%B1%80%E5%92%8C%E5%B1%80%E9%83%A8%E5%8F%98%E9%87%8F&amp;diff=118&amp;oldid=prev"/>
				<updated>2018-06-07T08:07:11Z</updated>
		
		<summary type="html">&lt;p&gt;创建页面，内容为“The Declaration of A &lt;a href=&quot;/index.php?title=Variable&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Variable（页面不存在）&quot;&gt;Variable&lt;/a&gt;&lt;a href=&quot;/index.php?title=Variables_declaration&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Variables declaration（页面不存在）&quot;&gt;Variables declaration&lt;/a&gt; in a &lt;a href=&quot;/index.php?title=Macro&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Macro（页面不存在）&quot;&gt;Macro&lt;/a&gt; can be GLOBAL or LOCAL.  == Global Declaration == The &amp;lt;code&amp;gt;GLOBAL&amp;lt;/code&amp;gt; modifier in the […”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The Declaration of A [[Variable]][[Variables declaration]] in a [[Macro]] can be GLOBAL or LOCAL.&lt;br /&gt;
&lt;br /&gt;
== Global Declaration ==&lt;br /&gt;
The &amp;lt;code&amp;gt;GLOBAL&amp;lt;/code&amp;gt; modifier in the [[variable]] declaration makes the [[variable]] created in the [[macro]] '''accessible''' to the main Program.&amp;lt;br /&amp;gt;&lt;br /&gt;
This is used when the result of a [[macro]] shall be used in the main program.&amp;lt;br /&amp;gt;&lt;br /&gt;
The Following example will show that the result of the [[macro]] will be in the DB Viewer even if the [[variable]] has not been declared explicitly in ARCO.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;span style=&amp;quot;color: green; text-decoration: none;&amp;quot;&amp;gt;$$ Example of a MACRO with GLOBAL Result&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;M(SUM_TWO_NUMBERS)=MACRO/NUMBER1,NUMBER2&amp;lt;/code&amp;gt;&lt;br /&gt;
::&amp;lt;code&amp;gt;DECL/GLOBAL,DOUBLE, RESULT&amp;lt;/code&amp;gt;&lt;br /&gt;
::&amp;lt;code&amp;gt;RESULT=ASSIGN/NUMBER1+NUMBER2&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ENDMAC&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;CALL/M(SUM_TWO_NUMBERS),100,200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Local Declaration ==&lt;br /&gt;
The &amp;lt;code&amp;gt;LOCAL&amp;lt;/code&amp;gt; modifier in the [[variable]] declaration makes the [[variable]] created in the [[macro]] '''NOT accessible''' to the main Program.&lt;br /&gt;
This is useful when a support [[variable]] shall be used in the [[macro]] but it is not interesting for the main program.&amp;lt;br /&amp;gt;&lt;br /&gt;
The Following example will show that the result of the [[macro]] will be in the DB Viewer '''but not the temporary [[variable]]'''.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;span style=&amp;quot;color: green; text-decoration: none;&amp;quot;&amp;gt;$$ Example of a MACRO with GLOBAL Result and Temporary Variable Locally declared&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;M(AVERAGE_3_NUMBER)=MACRO/NUMBER1,NUMBER2,NUMBER3&amp;lt;/code&amp;gt;&lt;br /&gt;
::&amp;lt;code&amp;gt;DECL/LOCAL,DOUBLE, SUM&amp;lt;/code&amp;gt;&lt;br /&gt;
::&amp;lt;code&amp;gt;DECL/GLOBAL,DOUBLE, RESULT&amp;lt;/code&amp;gt;&lt;br /&gt;
::&amp;lt;code&amp;gt;SUM=ASSIGN/NUMBER1+NUMBER2+NUMBER3&amp;lt;/code&amp;gt;&lt;br /&gt;
::&amp;lt;code&amp;gt;RESULT=ASSIGN/SUM/3&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ENDMAC&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;CALL/M(SUM_TWO_NUMBERS),100,200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[it:Variabile globale e locale nella macro]]&lt;br /&gt;
[[zh-cn:宏中的全局和局部变量]]&lt;br /&gt;
[[pt:Variável global e local na macro]]&lt;br /&gt;
[[de:Globale und lokale Variable im Makro]]&lt;br /&gt;
[[es:Variable global y local en macro]]&lt;br /&gt;
[[en:Global And Local Variable In Macro]]&lt;/div&gt;</summary>
		<author><name>Slia</name></author>	</entry>

	</feed>