Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

This is a central concept in writing good code. A function allows you to make a small piece of code which does one thing well and often can be reused if the same functionality is needed in multiple places. Functions apply a core design principal: /wiki/spaces/IXB/pages/3181903910.

Functions are Block statements.

Here’s a simple example:

function APPhello()
  return "Hello";
end 

Arguments are variables which are used to pass data into a function. You can optionally define the function as local to limit its scope:

function APPadd(a,b)
  return a + b 
end 

local sum = APPadd(2,3) --returns 5

Notice in the above example, the function returned the resulting value.

  • No labels