Product SiteDocumentation Site Functions

A Function is a statement, or a series of statements, that we want to use many times. When a Function is assigned to a variable, you can execute the Function as many times as you wish. Any statements that happen between braces { like this; } are treated as a Function. Functions are executed by passing them the "value" message, as in the following example.
Here is a Function that is not assigned to a variable, and is executed once.
{ "Hello, World!".postln; }.value;
Notice that there are two semicolons: one after the statement within the Function, and one after the "value" message that tells the Function to execute.
Here is a Function with identical function, assigned to a variable, and executed twice.
var myFunction = { "Hello, World!".postln; }; // note two semicolons