Wednesday, December 22, 2010

JavaFX Sequence

To create a sequence, type:
var names = ["lady gaga","steve jobs","bill gates"];
var ages = [24, 55, 58];
var value = [1..100];
var valued = value[n | n>50];    // greater than 50

To access an element from this sequence, use [ ] operator:
println(names[0]);    // print out lady gaga

To know how much size of the sequence, use:
println(sizeof names);

Use insert command to insert an element into sequence:
insert "barack obama" into names;
insert "larry page" after names[0];
insert "sergey brin" before names[0];
Use delete command to delete an element from sequence:
delete names[0];                 // delete lady gaga
delete "barack obama" from names;

Reversing sequence elements order:
value = reverse value;

No comments:

Post a Comment