{"identifier":10397,"topic":"HyperTalk basics","name":"Writing function handlers","text":"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: <br><br>\n\n <code><pre>function <i>functionName<\/i>\n   <i>statements<\/i>\nend <i>functionName<\/i>\n<\/pre><\/code> HyperCard has many built-in functions, but you can also write your own: <br>\n<br>\n<code><pre>on mouseUp\n  put square(5) into the Message box\nend mouseUp\nfunction square x\n  return (x * x)\nend square<\/pre><\/code> <br><br>\n\n The function<code> square <\/code>receives a number through its parameter variable,<code> x<\/code>.  It then returns the value of<code>  x * x <\/code>to the handler that called it (<code>mouseUp<\/code>) using the<code> return <\/code>keyword. <br>\n","related":{"20813":null,"25888":"function","11056":"The building blocks","10721":"Using parameter variables"},"examples":"","demo":"<br><br>\n\n ","debug":{"9":["When you write a han"],"10":["on mouseUp\r  put squ"]}}