Skip to content

Vector of functions error message #202

Open
@jariji

Description

@jariji
a = Vector{Function}(undef, 5)
for i in 1:5
    a[i](t) = cos(i*t)
end
ERROR: syntax: invalid function name "a[i]" around

https://discourse.julialang.org/t/vector-of-functions/94811

This error says what the problem is and where, but not how to solve it, which is to use an anonymous function a[i] = t -> cos(i*t).

If there is tooling to help generate this kind of message that would be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions