I'm working on a project with Google's Blockly, but parts of the documentation are incomprehensible. Can someone help me understand the end condition of the following for loop (xml = allXml[i])?
var allXml = Blockly.Xml.workspaceToDom(workspace);
var allCode = [];
for (var i = 0, xml; xml = allXml[i]; i++) {
var headless = new Blockly.Workspace();
Blockly.Xml.domToWorkspace(headless, xml);
allCode.push(Blockly.JavaScript.workspaceToCode(headless));
headless.dispose();
}
I imagine the loop will exit when allXml[i] is undefined, but how can you iterate through an XML object like this? It seems to always be returning undefined and skipping the loop entirely.
Thanks for you help
Definitions for most of the function can be found at https://code.google.com/p/blockly/source/browse/trunk/core/xml.js?r=1614
And the doc page I pulled this from is https://developers.google.com/blockly/custom-blocks/code-structure?hl=en