Skip to content

Iterator documentation uses an array when it probably meant to use a vec #24977

Closed
@bstrie

Description

@bstrie

http://doc.rust-lang.org/1.0.0-beta.3/book/iterators.html#iterators

See the third code block:

let nums = [1, 2, 3];

for num in nums.iter() {
   println!("{}", num);
}

Up to this point this chapter has used vec![] instead of [] exclusively, and even the paragraph above this code refers to "vectors". This has led to some confusion over whether [] creates a vector, which is probably not an explanation fit for this section.

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