Skip to content

[SR-1721] Nested functions need to be defined in code before they are used #44330

@swift-ci

Description

@swift-ci
Previous ID SR-1721
Radar None
Original Reporter mariano (JIRA User)
Type Improvement
Status Resolved
Resolution Won't Do

Attachment: Download

Additional Detail from JIRA
Votes 1
Component/s
Labels Improvement
Assignee None
Priority Medium

md5: 005ce6eb0b9b937beb33bb4e499a7a2f

Issue Description:

One approach to using nested functions is grouping pieces of code, for instance, configuration of several views in a function called `configureViews`.

In such task, the natural way of looking at it would be to call the functions first, as they serve as a sort of summary, and then define the functions later.

Doing so will result in the following error being displayed:
`Use of local variable `[functionName]` before its declaration`

See attached Playground.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions