E4006#
This error occurs when the same local function name is declared multiple times within the same scope. Each local function name must be unique within its scope.
Erroneous Example#
fn main {
fn helper() {
1 + 1
}
fn helper() { // E4006: local function 'helper' is already defined
2 + 2
}
helper()
}
Suggestion#
To fix this error, give each local function a unique name:
fn main {
fn helper1() {
1 + 1
}
fn helper2() {
2 + 2
}
helper1()
helper2()
}
You can also move one of the functions to a different scope or merge the functionality into a single function if they serve similar purposes.