<< 向前        下一页 >>

ID : 325

Function...End Function

功能

定义Function过程。

格式

Function 过程名自变量) As 数据型
	'Statements
End Function

指定项目

过程名
指定过程名。根据命名规则指定名称。
自变量
定义过程自变量。根据命名规则定义局部变量。通过“,”隔开可指定多个局部变量。另外也可创建无自变量的Function过程。
数据型
指定定义的函数返回值的数据型。

解说

定义Function过程。

相关项目

Sub...End Sub

注意事项

-

应用示例

'!TITLE "调出函数"
' 调出FucnProc函数,在aaa中代入计算结果
Sub Sample_FuctionEndFunction

  Dim aaa As Integer

  aaa = 10

  ' 在讯息输出视窗中显示aaa
  PrintDbg aaa

  aaa = FuncProc( aaa )

  ' 在讯息输出视窗中显示FuncProc函数的结果
  PrintDbg aaa

End Sub

Function FuncProc( bbb As Integer ) As Integer

  Dim ccc As Integer

  ccc = 10

  ' 将计算结果100作为返回值代入
  FuncProc = bbb * ccc

End Function

ID : 325

<< 向前        下一页 >>