On Oct 20, 8:43 pm, "Adam Maass" <adam.nospam.ma...@comcast.net>
wrote:> "MattandPaul...@talktalk.net" <mattymu...@aol.com> wrote :
...
are elements in the array.
What you probably meant was:
for(int x = 0; x < queue.length; x++){
queue[x] = '~';
}
It caused me great confusion in learning JavaScript that what
seems to be the equivalent syntax to Java's for (x: array) {...}
var arr = new Array(10);
for (var i in arr) {
...
}
would work as the OP had apparently anticipated, i.e., i would take
the values from 0 to 9 in the loop. Since JavaScript arrays
are really more like hash maps between numbers and values
it makes sense there, but it wasn't what I expected. Perl loops
over are similar to Java with
for my $x(@array) {...}
setting $x to each of the elements of the array.
Are there other languages that do it the way it's implemented
in JavaScript? Perhaps the OP was coming to Java with such a
background.
Regards,
Tom McGlynn