« One More Canvas Example - JavaFX Clock by Chris Oliver | Main | Update from Sun on the JavaFX Script Compiler »

November 11, 2007

Comments

James Weaver

Good points, codecraig! Thanks for your input!

codecraig

JavaFX Script does offer some interesting methods of querying and modifying arrays. I think the SQL-esque features are especially interesting:

import java.lang.System;

var x = [1..10];
foreach (i in x where i % 2 == 0)
System.out.println(i);

This example demonstrates a few things. First it uses a range to create a list of numbers from 1 through 10. Then I used the built-in foreach operator to iterate over the "x" list. In the foreach block I used some of the SQL-esque features such as "where i % 2 == 0" to print only the even numbers.

JavaFX Script is really interesting and has lots of goodies that I have yet to fool around with.

The comments to this entry are closed.

Categories