HyperCard: Writing Function Handlers (7/92)

How do I write function handlers?

When you write a handler for a function, you specify statements that
compute and return a value to the handler that calls the function. Each
function handler has the following form:

function functionName
statements
end functionName

HyperCard has many built-in functions, and you can write your own:

put square(5) into the Message box
end mouseUp

function square x
return (x * x)
end square

The function square receives a number through its parameter variable, x.
It then returns the value of x * x to the handler that called it (mouseUp)
using the return keyword.


This article is adapted from the Claris Tech Info database.
Published Date: Feb 19, 2012