Difference between revisions of "MC-Basic:PUBLIC SUB ... END SUB/zh-hans"

From SoftMC-Wiki
Jump to: navigation, search
(Created page with "{{Languages}} == 格式 == Public SUB ''<name>'' ({ {''ByVal''} ''<p_1>'' as ''<type_1>''}…{, {ByVal} ''<p_n> ''as <''type_n>}'')<br> ''{ local variable declaration ...")
 
 
Line 1: Line 1:
{{Languages}}
+
{{Languages|MC-Basic:PUBLIC_SUB_..._END_SUB}}
  
  
Line 15: Line 15:
  
 
== 类型 ==
 
== 类型 ==
  参数: Long, Double, String, Joint, Location, 用户定义的结构体, Generic Axis, Generic Group, Moving Frame (只能引用), Cam (只能引用), Comp (只能引用), Semaphore (只能引用), 用户定义的Error以及Note (只能引用)。
+
参数: Long, Double, String, Joint, Location, 用户定义的结构体, Generic Axis, Generic Group, Moving Frame (只能引用),  
 +
Cam (只能引用), Comp (只能引用), Semaphore (只能引用), 用户定义的Error以及Note (只能引用)。
  
  

Latest revision as of 02:03, 11 April 2017

语言: English  • 中文(简体)‎


格式

  Public SUB <name> ({ {ByVal} <p_1> as <type_1>}…{, {ByVal} <p_n> as <type_n>})
{ local variable declaration }
{ subroutine code }
END SUB

可用版本

所有版本

描述

用来定义一个可以在任何任务中调用的子程序。语句结构与SUB..END SUB一样, 但是只能在库文件中定义,以实现任何导入了该库的任务都能调用。子程序可迭代。

类型

参数: Long, Double, String, Joint, Location, 用户定义的结构体, Generic Axis, Generic Group, Moving Frame (只能引用), Cam (只能引用), Comp (只能引用), Semaphore (只能引用), 用户定义的Error以及Note (只能引用)。


可用范围

只能在库中使用

限制

数组只能通过引用传递

例子

  Public Sub Sub1(lastLoop as Long)???????????? 'Pass parameters by reference
Dim Index as long
For Index = 1 to lastloop
move a1 1 abs = 0
Next Index
  End Sub

可查阅