Loops¶
Writing for
and while
loops in PromptScript.
Loops in PromptScript function the same as in Python:
For Loops¶
for i in range(1, 11):
show i
You can also use len
:
string = "word"
for i in range(len(string)):
show i
Or iterate through values:
string = "word"
for character in string:
show character
While Loops¶
x = 10
while x > 0:
show x
x -= 1