Skip to content

Redim Preserve Inside Loop #3482

Open
Open
@IvenBach

Description

@IvenBach

Consider:

Dim foo()
'...
Do
    Redim Preserve foo(UBound(foo) + 1)
    foo(UBound(foo)) = n
    '...
While {condition}

Rubberduck should point out that the redimensioning is inefficient and excessive, and suggest using a Collection instead of an array, if the number of elements isn't known from the start.

Metadata

Metadata

Assignees

No one assigned

    Labels

    code-path-analysisInvolves simulating execution paths / interpreting the user code ..to an extent.discussionenhancementFeature requests, or enhancements to existing features. Ideas. Anything within the project's scope.feature-inspections

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions