PDA

View Full Version : syntax


red-arrow
09-06-2005, 11:39 PM
Is there anybody that can tell me the correct syntax of the " for cycle" in Laszlo? I tried some different syntax but it doesn't work.
THank you

Andrea

hqm
09-07-2005, 05:57 AM
I don't know what you are referring to. Can you tell me some more about what you are trying to do?

red-arrow
09-07-2005, 07:33 AM
for example

for (i=0; i<2; i++)
{
.... (I don't know if the istructions here should end with ";"
}

Thanks.



Andrea

hqm
09-07-2005, 08:09 AM
The for and for..in loop are standard Javascript (ECMAScript actually)

If you have a list foo = ['a', 'b', 'c', 'd']

you can do

for (var i = 0; i < foo.length; i++) {
Debug.write('foo ['+i+'] = '+ foo[i]);
}

Or you can do

for (var i in foo) {

}

Remember if you use a "<" or ">" or "&" char you need to either escape it or use <![CDATA[ block
to prevent it from being interpreted as XML escape char.

<method name="bar">
<![CDATA[
for (....) {}

]]>
</method>

red-arrow
09-08-2005, 07:34 AM
Thank you very much!!!

Andrea