9.3

Table Of Contents
Functions that return values
Some functions are designed to perform a calculation or determine the condition of an
object. Such functions create information, such as the result of the calculation or the state
of the object. When one of these functions is finished executing, it "returns" this
information.
For example, consider the function named Number.sqrt(). This function calculates the
square root of any value you pass to it. For example, if you want to find out the square
root of the number 25, you could indicate this as "Number.sqrt(25)".
However, "Number.sqrt(25)" is not a complete expression, because it doesn't tell an
interactive presentation what to do with the returned value (the square root of 25, or 5).
To create a complete expression, you have to tell the interactive presentation where to
place the information.
One way to do this is to place it into a variable:
IntVar = Number.sqrt(25)
After this expression has been evaluated, IntVar will be equal to 5.
Why does this function start with Number? In this case, Number simply indicates that this
function is a numerical function. For more information, see "Objects."
Objects
Some functions require an "object" (something to act upon). Such functions may either
change the state of the object or retrieve information about it. These functions are referred
to as "object functions" or "methods." For such functions, we use the following syntax:
objectName.functionName()
Object functions work just like other functions. We've already looked at this example:
Box1.Append(IntVar)
Here, the Text Box object named "Box1" is the object into which we want the Append
function to place the value represented by IntVar. This function is an example of an
object function that returns a value.
Here's an example of an object function that returns a value:
MyVariable = Box1.IsVisible()
In this expression, the IsVisible function checks to see whether the object named "Box1"
is visible, then it puts the Boolean result (either "true" or "false") into the variable named
MyVariable.
In addition to interactive objects, some object functions let you access other kinds of
objects. For example:
MyVariable = Number.Sqrt(2)
330 | A GUIDE TO QUARKXPRESS 9.3
INTERACTIVE LAYOUTS