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 books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.