Did not program for some years - so I tried to understand the (speed and memory) differences between variables (global, local, hidden, public) and their types (long vs. number)...
Interestingly I was not able to assign a larger value to a long variable directly, for example the code var l=2147483647.toLong(); l=2147483648; is not allowed. Is there a workaround?
Also didn't find if calculating with numbers or long variables do have an impact in memory or execution speed - did anyone made some more tests here?
function onUpdate(dc) as Void { var l=2147483647.toLong(); // 8 byte (-9223372036854775808 to 9223372036854775807) var n=2147483647.toNumber(); // 4 byte (-2147483648 to 2147483647) l=l<<16+65535; l=l<<16+65535; for(var i = 0; i<8; i++) { dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_TRANSPARENT); dc.drawText(120, i*30,Graphics.FONT_SMALL,l,Graphics.TEXT_JUSTIFY_LEFT); dc.drawText(120,300+i*30,Graphics.FONT_SMALL,n,Graphics.TEXT_JUSTIFY_LEFT); l=l+1; n=n+1; } }