<< Prev        Next >>

ID : 325

Function...End Function

Function

To declare the Function procedure.

Syntax

Function procedure name(argument) As data type
	'Statements
End Function

Guaranteed entry

Procedure name
Designate a procedure name. Each name must be specified in accordance with the Naming convention.
Argument
Declare an argument of the procedure. Designate a name based on Naming convention. More than one variable can be designated by separating each by a comma. You can also create a Function procedure with no argument.
Data type
Designate a data type of the return value of the function to declare.

Description

The Function procedure is declared.

Related Terms

Sub...End Sub

Attention

-

Example


'!TITLE "Calling Function"
' Call the FucnProc function and assign the calculation result to aaa
Sub Sample_FuctionEndFunction
  Dim aaa As Integer
  aaa = 10
  ' Display aaa on the message output window
  PrintDbg aaa
  aaa = FuncProc( aaa )
  ' Display the result of FuncProc function on the message output window
  PrintDbg aaa
End Sub
Function FuncProc( bbb As Integer ) As Integer
  Dim ccc As Integer
  ccc = 10
  ' Assign the calculation result 100 as a return value
  FuncProc = bbb * ccc
End Function

ID : 325

<< Prev        Next >>