1
0
dust/examples/yield.ds

14 lines
185 B
Plaintext
Raw Normal View History

2023-12-30 02:15:03 +00:00
add_one = (numbers <[int]>) <[int]> {
2023-11-27 20:02:08 +00:00
new_numbers = []
2023-11-16 07:11:47 +00:00
2023-11-27 20:02:08 +00:00
for number in numbers {
2023-11-27 22:53:12 +00:00
new_numbers += number + 1
2023-11-07 00:10:12 +00:00
}
2023-11-16 07:11:47 +00:00
2023-11-27 20:02:08 +00:00
new_numbers
2023-11-07 00:10:12 +00:00
}
2023-12-30 02:15:03 +00:00
foo = [1, 2, 3] -> add_one
2023-12-30 02:15:03 +00:00
assert_equal([2 3 4] foo)