0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-21 13:39:22 +01:00
posthog/hogvm/__tests__/upvalues.hog
2024-08-30 11:51:36 +02:00

24 lines
298 B
Plaintext

fun returnCallable(a) {
return x -> x * a
}
let double := returnCallable(2)
let triple := returnCallable(3)
print(double(2)) // 4
print(triple(2)) // 6
print('----------')
fun outer() {
let x := 'outside'
fun inner() {
print(x)
}
return inner
}
let closure := outer()
closure()