0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-24 09:14:46 +01:00
posthog/hogvm/__tests__/loops.hog

28 lines
422 B
Plaintext

print('-- test while loop --')
{
let i := 0
while (i < 3) {
i := i + 1
print(i)
}
print(i)
}
print('-- test for loop --')
{
for (let i := 0; i < 3; i := i + 1) {
print(i) -- prints 3 times
}
print(i) -- global does not print
}
print('-- test emptier for loop --')
{
let i := 0;
for (;i < 3;) {
print('woo')
i := i + 1;
}
print('hoo')
}