Due to a recent SimpleScript update you can now use functions for looping and doing more advanced work in workers.

To create a function you set it anywhere in your code like this example function.

f.amisandbox{
v.amsandbox=s.ami_sandbox()
s.echo("function worked, am I sandbox is v.amsandbox")
}


This sample function when you run it with f.amisandbox() will say true or false depending on if it's running in the sandbox.

Here is a loop function example that will repeat the same line with each animal name.

v.animals[0]="cat"
v.animals[1]="dog"
v.animals[2]="turtle"
v.animals[3]="fish"
s.array_loop("pets",v.animals)

f.pets{
v.pet=v.function_passed[0]
s.echo("Oh, did you know I have a v.pet?")
}
Was this article helpful?
Cancel
Thank you!