Function handlers
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
end functionName
NovoCard has many built-in functions, but you can also write your own:
on touchUp
answer(String(square(5)));
end touchUp
function square x
result(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 (touchUp) using the result command.