-
Notifications
You must be signed in to change notification settings - Fork 0
Loops
Julius Paffrath edited this page Jul 2, 2026
·
3 revisions
jask provides three different ways to repeat code:
- while
- for in
- repeat times
The following sections explains each way.
A while-loop will repeat the code as long as a condition is true:
set i to 0
while i < 5
print(i)
set i to i + 1
endwhileWith the break-Statement you can control the termination of the loop:
set i to 0
while true
print(i)
if i == 100 break endif
set i to i + 1
endwhileUse for in if you need to iterate over a set of data stored in a list:
set myList to list(1, 2, 3)
for element in myList
print(element)
endforWith repeat times one can repeat a statement a predefined number of times (as the name suggests):
repeat task() 5 times