Tuesday, December 21, 2010

JavaFX Variable

There are two type of variables in JavaFX. The first is def. def means that the variable won't change through all of the program running, or in other words it means that def is for declaring a constant:
def name = "lady gaga";
def code = 45;
def sleep = false;

While var is for declaring a variable that may be change over program running.
var name;
var code;
var sleep;

To display var or def, use curly bracket:
println("Hello, {name}");

No comments:

Post a Comment