Repeats execution while condition is true.
while (condition) expression
condition - any expression that returns a number (0 = false, non-zero = true)expression - executed each iterationValue of the last iteration, or void if never executed
i = 0
while (i < 5) {
i = i + 1
}
print(i)
# Output: 5
sum = 0
i = 1
while (i <= 10) {
sum = sum + i
i = i + 1
}
print(sum)
# Output: 55
arr = [10, 20, 30, 40]
i = 0
while (i < length(arr)) {
print(arr[i])
i = i + 1
}
# Output:
# 10
# 20
# 30
# 40
i = 0
while (1) {
i = i + 1
if (i >= 10) {
i
}
}
print(i)
# Output: 10
© 2026 elliktronic · Jaf Language