I ran into a program from a novice using a strange syntax that apparently was acceptable.
The program was printing text inside a loop, but used the loop iterator enclosed in brackets
to position the text, such as:
text(list[i], [i], 20);
And oddly enough it works, as in:
var txt = ["A", "B", "C", "D", "E"];
fill(0);
for (var i=0; i<txt.length; i++){
text(txt[i], 20, [i]); // what is [i] ???
text(i + " " + [i], 40, [i]); // clearly not = i, or is it?
}
textAlign(LEFT, TOP); // something to do with text() ?
for (var j=txt.length; j--;){
text(txt[j], 200, [j]);
text(j + " " + [j], 240, [j]);
}
The output should all be at Y locations of 1-4, but its not.
In the first loop, the text is on a separate line, and in the
second loop, the text is like on separate paragraphs.
I can find no documentation that explains this, does someone have
some insight as to what is going on?
Thanks
LFS