Count and accumulate
The loop regression example adds the numbers 0 through 9. It starts both variables at zero, then increments 'count' until the condition is false.
aayu
let count = 0
let sum = 0
while count < 10
sum = sum + count
count = count + 1
end
print(sum)Expected sum: 45. If the counter update is removed, the loop never ends; if the condition changes to 'count < 9', the final sum changes. The regression file also checks the result with an if/else.