Beispiel für eine Subroutine
Das folgende Beispiel enthält die Deklaration und den Aufruf einer Subroutine.
[create $outputpath & $module & "output.txt"
' define sub SimpleSub() Sub SimpleSub() ]SimpleSub() called [endsub
' execute sub SimpleSub() Call SimpleSub()
$ParamByValue = "Original Value" ]ParamByValue = [=$ParamByValue] [$ParamByRef = "Original Value" ]ParamByRef = [=$ParamByRef]
' define sub CompleteSub() [Sub CompleteSub( $param, ByVal $paramByValue, ByRef $paramByRef ) ]CompleteSub called. param = [=$param] paramByValue = [=$paramByValue] paramByRef = [=$paramByRef] [$ParamByRef = "Local Variable" $paramByValue = "new value" $paramByRef = "new value" ] Set values inside Sub [$ParamByRef = "Local Variable" $paramByValue = "new value" $paramByRef = "new value" ]CompleteSub finished. [endsub
' run sub CompleteSub() Call CompleteSub( "FirstParameter", $ParamByValue, $ParamByRef ) ] ParamByValue=[=$ParamByValue] ParamByRef=[=$ParamByRef] [ Close ] |