Skip to content

typo in vectorMultiply example of getting started document #36

@timsherwood

Description

@timsherwood

Minor bug in getting started document at start of Section 2.2 Arrays, in the code:

function vectorMultiply(int[] vector, int[] scalar) -> int[]:
    int i = 0
    while i < |vector|:  // needs loop invariant
        vector[i] = vector[i] * scalar
        i = i + 1
    return vector

Scalar is defined as an array (which I assume is just a typo). I would also mention that this code does not compile even with that fixed without the loop invariant i>=0 (unless I am doing something wrong) but perhaps that is intentional (to avoid getting into that discussion so early in the document). If you are not looking yet for such trivial errors given your other work, please just ignore. :)

Really enjoying playing with this language, thanks for making it so accessible!

-Tim ([email protected])

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