Skip to main content

JavaFX Script Programming Language

1 reply [Last post]
Joined: 2010-02-04
Points: 0

The previous lesson walked you through setting up a development environment; here we will take a closer look at the Calculator.fx source code. The code in red below declares the program's script variables. Script variables are declared using the var or def keywords. The difference between the two is that var variables may be assigned new values throughout the life of the script, whereas def1 variables remain constant at their first assigned value. Here we have assigned some values to numOne and numTwo, but have left result uninitialized because this variable will hold the result of our future calculations:

def numOne = 100;
def numTwo = 2;
var result;


function add() {
result = numOne + numTwo;
println("{numOne} + {numTwo} = {result}");

function subtract() {
result = numOne - numTwo;
println("{numOne} - {numTwo} = {result}");

function multiply() {
result = numOne * numTwo;
println("{numOne} * {numTwo} = {result}");

function divide() {
result = numOne / numTwo;
println("{numOne} / {numTwo} = {result}");

baby name gift
special baby gifts

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2010-03-03
Points: 0

Thanks your JavaFX Script Programming Language . but i think some little error in your code. deeply check it .

[url=]driving lessons in Birmingham[/url]
[url=]driving schools in Birmingham[/url]
[url=]intensive driving courses in Birmingham[/url]