Home THE HYPERCARD CENTER

HyperTalk Reference
Home » HyperTalk Reference »

Note: This is a work in progress and many formatting issues have been fixed. Read more about the project on the home page.

Writing 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, where the italicized words are placeholders:

function functionName
statements
end functionName

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

on mouseUp
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.

Related Topics

Placeholders

functionName

Any text string, without quotation marks, that represents the name of the function handler you want to write:

myAverage
onlyOneWindow

As in the HyperTalk examples:

function myAverage theNumbers
function onlyOneWindow

statements

Any return-separated list of built-in commands, user-defined handlers, or keywords that are part of a message or function handler.

put "Hello world" -- built-in command
get total(field 1) -- function call
global HelpInfo -- keyword

HyperTalk Reference


Version 0.8b4 (July 4, 2025)

Made with Macintosh

Switch to Modern View