MC-Basic:PUBLIC SUB ... END SUB/zh-hans

From SoftMC-Wiki
< MC-Basic:PUBLIC SUB ... END SUB
Revision as of 02:02, 11 April 2017 by Chi (talk | contribs) (Created page with "{{Languages}} == 格式 == Public SUB ''<name>'' ({ {''ByVal''} ''<p_1>'' as ''<type_1>''}…{, {ByVal} ''<p_n> ''as <''type_n>}'')<br> ''{ local variable declaration ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
语言: [[::MC-Basic:PUBLIC SUB ... END SUB|English]]  • [[::MC-Basic:PUBLIC SUB ... END SUB/zh-hans|中文(简体)‎]]


格式

  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

可查阅