Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Defining a return type – PB Docs 2021 – PowerBuilder Library

Defining a return type – PB Docs 2021

Defining a return type

Many functions perform some processing and then return a value.
That value can be the result of the processing or a value that
indicates whether the function executed successfully or not. To have
your function return a value, you need to define its return type,
which specifies the datatype of the returned value.

You must code a return statement in the function that specifies
the value to return. See Returning a
value
. When you call the function in a script or another
function, you can use an assignment statement to assign the returned
value to a variable in the calling script or function. You can also
use the returned value directly in an expression in place of a
variable of the same type.

To define a function’s return type

  • Select the return type from the Return Type drop-down list
    in the Prototype window, or type in the name of an object type you
    have defined.

    You can specify any PowerBuilder datatype, including the
    standard datatypes, such as integer and string, as well as objects
    and controls, such as DataStore or MultiLineEdit.

    You can also specify as the return type any object type that
    you have defined. For example, if you defined a window named
    w_calculator and want the function to process the window and
    return it, type w_calculator in the Return Type list. You cannot
    select w_calculator from the list, because the list shows only
    built-in datatypes.

To specify that a function does not return a value

  • Select (None) from the Return Type list.

    This tells PowerBuilder that the function does not return a
    value. This is similar to defining a procedure or a void function
    in some programming languages.

Examples of functions returning
values

The following examples show the return type you would specify
for some different functions:

If you are defining

Specify this return type

A mathematical function that does some processing
and returns a real number

real

A function that takes a string as an argument and
returns the string in reverse order

string

A function that is passed an instance of window
w_calculator, does some processing (such as changing the
window’s color), then returns the modified
window

w_calculator


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x