"For" loop.
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Is there a "For" loop in Algodoo or Phun?
Like in Pascal or C.
Like in Pascal or C.
/* for - A simple looping structure in Thyme.
Used like this: for(n, (i)->{ ... }); where n is the number of times to call the function. i will be given the values 0, 1, ..., n-2, n-1
Example:
for(4, (n)=>{print ((n+1) + " bottles of beer on the wall.")})
Output:
1 bottles of beer on the wall.
2 bottles of beer on the wall.
3 bottles of beer on the wall.
4 bottles of beer on the wall.
for(3, (i)=>{ scene.my.variable = scene.my.variable + i })
KarateBrot wrote:No i can't be bigger than n because n is the limit.
Do you know the sum-function in maths? for is exactly this thing.