Files
@ r14248:a9050881acd7
Branch filter:
Location: cpp/openttd-patchpack/source/src/3rdparty/squirrel/samples/array.nut - annotation
r14248:a9050881acd7
433 B
text/plain
(svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header
r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 r11225:37853e3b55c7 | /*
*
* Original Javascript version by David Hedbor(http://www.bagley.org/~doug/shootout/)
*
*/
local n, i, k;
if(ARGS.len()!=0) {
n = ARGS[0].tointeger();
if(n < 1) n = 1;
} else {
n = 1;
}
local x = []; x.resize(n);
local y = []; y.resize(n);
for (i = 0; i < n; i+=1) {
x[i] = i + 1;
y[i] = 0;
}
for (k = 0 ; k < n; k+=1) {
for (i = n-1; i >= 0; i-=1) {
y[i] = y[i]+ x[i];
}
}
print(y[0].tostring()+" "+y[n-1]);
|