> At 1/21/08, you wrote: >>Can a for loop in Jmol take two variables, as follows? >> >> for ( var i = -9, j = 2; i < -4.0; i = i + 0.2, j = j + 1 ) >> no, can't do that. Eric's solution is what you need to do, although it should read:
var j = 2; for (var i = -9; i < -4.0; i = i + 0.2); # do your work here; j = j + 1; end for; Niether += nor ++ have been implemented in Jmol. Since they are simply conveniences, I'm not seeing them as priority items. Note that the above loop may not work the way you wish due to imperfect representation of decimal numbers in binary. When I ran the following: FOR (VAR I = -9; I < -4;I = I + 0.2);PRINT I;END FOR; I see: -9 -8.8 -8.6 -8.400001 -8.200001 -8.000001 -7.800001 -7.6000013 -7.4000015 -7.2000017 -7.000002 -6.800002 -6.6000023 -6.4000025 -6.2000027 -6.000003 -5.800003 -5.6000032 -5.4000034 -5.2000036 -5.000004 -4.800004 -4.600004 -4.4000044 -4.2000046 -4.000005 Note especially the final value. This is a general problem with using noninteger numbers in a for loop. Much better would be: FOR (VAR I = -45; I < -20;I = I + 1);PRINT I/5.0;END FOR; which gives the expected: -9.0 -8.8 -8.6 -8.4 -8.2 -8.0 -7.8 -7.6 -7.4 -7.2 -7.0 -6.8 -6.6 -6.4 -6.2 -6.0 -5.8 -5.6 -5.4 -5.2 -5.0 -4.8 -4.6 -4.4 -4.2 Bob ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Jmol-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jmol-users

