We use cookies to ensure that we give you the best user experience on our website.If you want to find out more about the cookies we use, you can access to our Privacy Policy here.By continuing your visit to our website, we'll assume you consent to our use of cookies.

DENSO DENSO WAVE

Close

Technical Information

Application Development Manual

Creating user-defined functions

Function

Create a user-defined function.

Syntax

Function returning a value

Function returning no value

Detailed Description

This statement defines user-defined functions for processing shared by multiple parts of the same program.

Examples

User-defined function for adding two values

  function addfunc%( a%, b% )
addfunc% = a% + b%
end function
main:
private result%
result% = addfunc%( 200,300 )  ' call function addfunc%
print result%                  ' displays 500

User-defined function waiting for a key press

  sub waitfunc
private tempkey$
print "Press a key"
tempkey$ = input$(1)
end sub
main:
call waitfunc                  ' call function waitfunc
print "A key has been pressed."

User-defined function displaying a fixed screen

  sub dispfunc( process$, UserID$ )
print "**********"
print process$
print "ID:";UserID$
print "**********"
end sub
main:
private PROC$
private ID$
PROC$ = "Inventory"
ID$ = "10012"
call dispfunc( PROC$, ID$ )    ' call function dispfunc
' displays Inventory
' displays ID:10012

Contact us

QBdirect

If you have not registered

The services on this member site are available only for registered customers.

New member reg.