Thyme for function

About advanced scenes, and the Thyme scripting language used in Algodoo.

Thyme for function

Postby Skrubs » Fri Jul 06, 2018 8:35 pm

How to use the function "For" in thyme ? how it works ?
Skrubs
 
Posts: 16
Joined: Tue Mar 06, 2018 7:36 pm

Re: Thyme for function

Postby FRA32 » Sun Aug 05, 2018 1:39 pm

The for function is used with this syntax:
for(limit,(counter)=>{code})
Limit is a number or variable containing a number, specifying for often the loop executes(it maxes out at 100 iterations however). The counter is any variable name, most often "i". It stores the index of the current iteration.
An example would be:

for(5,(i)=>{
text = text + i
})

After running the script, the objects text variable would have "01234" attached to the end.
FRA32
 
Posts: 171
Joined: Wed Dec 03, 2014 9:51 pm

Re: Thyme for function

Postby Skrubs » Mon Sep 17, 2018 3:04 am

Learned thanks
Skrubs
 
Posts: 16
Joined: Tue Mar 06, 2018 7:36 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 2 guests

cron