Skip to content

Error when accessing array by index inside map function #2571

@rjmat97

Description

@rjmat97

I'm ubnable to access an external array value by index within a map function.

Here I'm attempting to write a python style zip function that zip two lists together. But on compilation it's throwing an error. I'm not entirely sure why this is happening since accessing arrays using indices outside the map function seem to work.

export function zip(list1:Array<string>, list2:Array<string>):string[][]{
  return list1.map<string[]>((i:string,d:i32):string[] => [i, list2[d]])
}

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions