Skip to content

Passing value type functions to the arrow function #20

@ppaska

Description

@ppaska

This code doesn't work

x = [1, 2,3,4,5,6]
sum = 0
f.forEach(v => sum = sum + v)
print(sum) # incorrect sum will be here

# workaround is to add it to the object. e.g.

sum = {value: 0}
f.forEach(v => sum.value = sum.value + v)
print(sum.value) # correct sum will be here

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions