Call: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
No edit summary
No edit summary
Line 10: Line 10:


<pre>
<pre>
REM Call Example
Rem Call Example
'Call explicitly executes a procedure
'Call explicitly executes a procedure
Call Welcome
Call Welcome
Call Message("NS Basic/App Studio is excellent.")
Call Message("NS Basic/App Studio is excellent.")
Wave
Wave
FUNCTION Welcome
Function Welcome
   PRINT "Hello World!"
   Print "Hello World!"
END FUNCTION
End Function
FUNCTION Message(Text)
Function Message(Text)
   PRINT "Message: " & Text
   Print "Message: " & Text
END FUNCTION
End Function
SUB Wave
Sub Wave
   PRINT "Goodbye! "
   Print "Goodbye! "
END SUB
End Sub
</pre>
</pre>


Line 36: Line 36:
== Related Items ==
== Related Items ==


[[sub|SUB]], [[function|FUNCTION]]
[[sub|Sub]], [[function|Function]]


[[Category:Language Reference]]
[[Category:Language Reference]]

Revision as of 00:22, 24 August 2012

Call procedurename[(argList)]

Description

Call is an explicit method of executing a FUNCTION procedure or a SUB procedure. The required component, procedurename, is any procedure name. The optional component, argList, is a comma-delimited list of variables to pass to the called procedure. The Call keyword is optional, procedures can be executed without the keyword, as

name[(argList)]

Example

Rem Call Example
'Call explicitly executes a procedure
Call Welcome
Call Message("NS Basic/App Studio is excellent.")
Wave
Function Welcome
  Print "Hello World!"
End Function
Function Message(Text)
  Print "Message: " & Text
End Function
Sub Wave
  Print "Goodbye! "
End Sub

Output

Hello World!
Message: NS Basic/App Studio is excellent.
Goodbye!

Related Items

Sub, Function