> Next I would like to try and make a matrix output. [...]
> I am struggling to think how one would go about writing the 'for'
> loops to write the different elements.
I'm afraid I don't understand what it is you're trying to do.
Also, your example there seems to be working fine!?
If by matrix you mean multi-dimensional arrays, you'd use nested loops:
var L = [
[1, 2, 3],
[4, 5, 6]
];
for(var i = 0; i < L.length; i++) {
var list = L[i];
for(var j = 0; j < list.length; j++) {
var item = list[j];
}
}
Depending on your use case, you might be better of using a hash map:
var D = {
a: [1, 2, 3],
b: [4, 5, 6]
}
You can access the individual values with D.a and D.b. Iterating over
those requires a little more care though:
https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Statements/for...in
https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Statements/for_each...in
HTH.
-- F.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/TiddlyWikiDev?hl=en
-~----------~----~----~----~------~----~------~--~---