Chapter 5. Functions

A function is a block of statements enclosed within curly braces. This block is given a name and is invoked using the specified name.

One of the important reasons to use functions is that they help organize the code conceptually and logically, avoiding redundancy within your program. Functions help break the bulk of code into smaller chunks by logically grouping the statements. Typically the code that is called frequently within your program is moved to a function that is then invoked from multiple places instead of duplicating the same code in all the places. Sometimes this is referred to as the "divide and conquer" approach.

In JavaFX Script, functions can be classified into two types based on where they are located within ...

Get Beginning JavaFX™ now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.