Ejemplo de subrutina
Este ejemplo muestra la declaración e invocación de subrutinas.
[create $outputpath & $module & "output.txt"
' definir sub SimpleSub() Sub SimpleSub() ]SimpleSub() called [endsub
' ejecutar sub SimpleSub() Call SimpleSub()
$ParamByValue = "Original Value" ]ParamByValue = [=$ParamByValue] [$ParamByRef = "Original Value" ]ParamByRef = [=$ParamByRef]
' definir 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
' ejecutar sub CompleteSub() Call CompleteSub( "FirstParameter", $ParamByValue, $ParamByRef ) ] ParamByValue=[=$ParamByValue] ParamByRef=[=$ParamByRef] [ Close ] |