1
0
dust/examples/scope.ds
2023-10-29 19:31:06 -04:00

61 lines
621 B
Plaintext

# Function
x = "bar"
func = function <> {
x = "foo"
x
}
assert_equal("foo", (func))
assert_equal("bar", x)
# For Loop
x = 42
for number in [1 2 3] {
x += number
}
assert_equal(48, x)
# Async Loops
## Transform Loop
x = 42
y = [1 2 3]
transform number in y {
number += x
x = 1000
}
assert_equal([43, 44, 45], y)
assert_equal(42, x)
## Filter Loop
x = 42
y = [1 2 3]
transform number in y {
number += x
x = 1000
}
assert_equal([43, 44, 45], y)
assert_equal(42, x)
## Filter Loop
x = 42
y = [1 2 3]
filter number in y {
number += x
x = 1000
}
assert_equal([43, 44, 45], y)
assert_equal(42, x)