Please.

fun {MainSum N}

local Sum in

fun {Sum N Acc}

if N==0 then Acc

else

Acc = Acc+(N*N)

N = N-1

end

{Sum N 0}

end

end

local Sum in

fun {Sum N Acc}

if N==0 then Acc

else

Acc = Acc+(N*N)

N = N-1

end

{Sum N 0}

end

end

Please add triple backquotes around your code to preserve indentation.

local Sum in

fun {Sum N Acc}

if N==0 then Acc

else

Acc = Acc+(N*N)

N = N-1

end

{Sum N 0}

end

end

'''

fun {MainSum N}

local Sum in

fun {Sum N Acc}

if N==0 then Acc

else

Acc = Acc+(N*N)

N = N-1

end

{Sum N 0}

end

end

'''

fun {MainSum N}

local Sum in

fun {Sum N Acc}

if N==0 then Acc

else

Acc = Acc+(N*N)

N = N-1

end

{Sum N 0}

end

end

'''

You don't have a syntax error. You are trying to reassign immutable variables.

`Acc = Acc+(N*N)`

doesn't mean anything. No more than saying "let x = x + n²" in mathematics. You just can't change the value of variables.
```
fun {MainSum N}
local Sum in
fun {Sum N Acc}
if N==0 then Acc
else
Acc = Acc+(N*N)
N = N-1
end
{Sum N 0}
end
end
```

You need to call

`Sum`

recursively with different values for the parameters `N`

and `Acc`

instead.
Thank you.

So, instead of

```
Acc = Acc+(N*N)
{Sum Acc N*N}
```